File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,12 @@ for (T, mlir_func) in (
206
206
207
207
splatattr = MLIR. API.$ mlir_func (tt, number)
208
208
cst_op = stablehlo. constant (; output= tt, value= splatattr, location= location)
209
+
210
+ parent_func_op = MLIR. IR. get_parent_of_type_function_op (cst_op)
211
+ if parent_func_op == C_NULL
212
+ error (" Constant must be created inside a Function Op." )
213
+ end
214
+
209
215
cst = MLIR. IR. result (cst_op)
210
216
ta = TracedRArray {$T,length(shape)} ((), cst, shape)
211
217
return ta
226
232
tt = MLIR. IR. TensorType (shape, MLIR. IR. Type (T))
227
233
splatattr = MLIR. API. mlirDenseElementsAttrSplatGet (tt, _fill_element_attr (element))
228
234
cst_op = stablehlo. constant (; output= tt, value= splatattr, location= location)
235
+
236
+ parent_func_op = MLIR. IR. get_parent_of_type_function_op (cst_op)
237
+ if parent_func_op == C_NULL
238
+ error (" Constant must be created inside a Function Op." )
239
+ end
240
+
229
241
cst = MLIR. IR. result (cst_op)
230
242
ta = TracedRArray {T,length(shape)} ((), cst, shape)
231
243
return ta
You can’t perform that action at this time.
0 commit comments