Commit 040aec9
authored
[lib/conversion] Create seed only if needed in `convert-torch-convers… (llvm#3926)
…ion-to-mlprogram` pass
This PR changes `convert-torch-conversion-to-mlprogram` pass
implementation by moving seed generation inside `ConvertGetNextSeedOp`
pattern.
Previously, global seed was being created by this pass, even when its
only consumer `torch_c.get_next_seed` op is not present in the IR. This
pass is part of Torch->Linalg conversion pipeline. Always creating
global seed created an issue for the case when downstream compiler
doesn't expect/support `ml_program` dialect in linalg on tensor IR
format. However, when starting torch IR has `torch_c.get_next_seed` op,
`ml_program` will still be present and will need to be handled by
downstream compilers.1 parent 62eb38b commit 040aec9
File tree
3 files changed
+21
-6
lines changed- lib/Conversion/TorchConversionToMLProgram
- test/Conversion/TorchConversionToMLProgram
3 files changed
+21
-6
lines changedLines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
62 | 69 | | |
63 | 70 | | |
64 | 71 | | |
| |||
115 | 122 | | |
116 | 123 | | |
117 | 124 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | 125 | | |
124 | 126 | | |
125 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
0 commit comments