You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tl;dr: when you specify LowForm or HighForm as your inputForm/outputForm in a custom transform, you may either be inadvertently writing a transform that relies on ResolveAndCheck or your transform may not be portable between -X low and -X verilog.
For a custom transform that outputs HighForm, the re-lowering (or lack thereof) is a function of the inputForm due to getLoweringTransforms logic.
inputForm == HighForm will result in no re-lowering
inputForm < HighForm will result in IrToWorkingIr, ResolveAndCheck, and Dedup
This effectively defines HighForm as either (up through) Dedup or ChirrtlToHighFirrtl.
Consequently, a user writing a {Low, Mid} -> High transform may be relying on this re-lowering, e.g., they emit unresolved types.
Going forward, the dependency API port redefines HighForm to mean Deduped, but preserves backwards compatibility for transforms that output HighForm without overriding the dependency API methods.
Low Form Ambiguity
By the current definition of mergeTransforms a custom transform will run after the last transform which has an outputForm equal to its inputForm. However, the last transform which has outputForm == LowForm is a function of the chosen compiler/emitter. Concretely a LowForm transform, for the chosen compiler, has the following behavior:
-X low: transform runs after MiddleFirtlToLowFirrtl
-X mverilog: runs after MinimumLowFirrtlOptimizations
-X verilog: runs after LowFirrtlOptimizations
This has implications in that a user can write a LowForm transform that works with -X verilog, but fails for -X low. (Consider a transform that will match error on IsInvalid. This transform will error for -X low, but work for -X verilog because RemoveValidIf is an optimization transform. h/t @jackkoenig)
This behavior is preserved in how dependency API dependencies are derived from inputForm/outputForm for users that do not override dependency API methods.
Metadata
Type of issue: bug report
If the current behavior is a bug, please provide the steps to reproduce the problem:
What is the current behavior?
A LowForm transform will run in different places for different compilers.
What is the expected behavior?
A LowForm should run in the same location, regardless of compiler.
Please tell us about your environment:
(examples)
master
What is the use case for changing the behavior?
This can cause subtle bugs where LowForm transforms don't work on LowForm.
Impact: unknown
Development Phase: request
The text was updated successfully, but these errors were encountered:
Closed via #1534. This behavior is capable of being expressed if a user wants it in the new Dependency API. Alternatively, this behavior is the default if a user does not migrate to the new Dependency API.
tl;dr: when you specify
LowForm
orHighForm
as yourinputForm
/outputForm
in a custom transform, you may either be inadvertently writing a transform that relies onResolveAndCheck
or your transform may not be portable between-X low
and-X verilog
.This weirdness is preserved in #1123.
High Form Ambiguity
For a custom transform that outputs
HighForm
, the re-lowering (or lack thereof) is a function of theinputForm
due togetLoweringTransforms
logic.inputForm == HighForm
will result in no re-loweringinputForm < HighForm
will result inIrToWorkingIr
,ResolveAndCheck
, andDedup
This effectively defines
HighForm
as either (up through)Dedup
orChirrtlToHighFirrtl
.Consequently, a user writing a
{Low, Mid} -> High
transform may be relying on this re-lowering, e.g., they emit unresolved types.Going forward, the dependency API port redefines
HighForm
to meanDeduped
, but preserves backwards compatibility for transforms that outputHighForm
without overriding the dependency API methods.Low Form Ambiguity
By the current definition of
mergeTransforms
a custom transform will run after the last transform which has anoutputForm
equal to itsinputForm
. However, the last transform which hasoutputForm == LowForm
is a function of the chosen compiler/emitter. Concretely aLowForm
transform, for the chosen compiler, has the following behavior:-X low
: transform runs afterMiddleFirtlToLowFirrtl
-X mverilog
: runs afterMinimumLowFirrtlOptimizations
-X verilog
: runs afterLowFirrtlOptimizations
This has implications in that a user can write a
LowForm
transform that works with-X verilog
, but fails for-X low
. (Consider a transform that will match error onIsInvalid
. This transform will error for-X low
, but work for-X verilog
becauseRemoveValidIf
is an optimization transform. h/t @jackkoenig)This behavior is preserved in how dependency API dependencies are derived from
inputForm
/outputForm
for users that do not override dependency API methods.Metadata
Type of issue: bug report
If the current behavior is a bug, please provide the steps to reproduce the problem:
A
LowForm
transform will run in different places for different compilers.A
LowForm
should run in the same location, regardless of compiler.(examples)
master
What is the use case for changing the behavior?
This can cause subtle bugs where
LowForm
transforms don't work onLowForm
.Impact: unknown
Development Phase: request
The text was updated successfully, but these errors were encountered: