@@ -236,10 +236,6 @@ function __build_codelet(graph::Poplar.GraphAllocated, kernel, name::String, ori
236236 " _llvm_colossus_urand32" => " llvm.colossus.urand32" ,
237237 " _llvm_colossus_urand64" => " llvm.colossus.urand64" ,
238238 )
239- # Do not allow references to literal pointers, which are likely to be invalid on the IPU
240- if contains (llvm_ir, r" inttoptr +\( i64 +\d +" )
241- error (" LLVM IR generated for codelet $(name) contains a reference to a literal pointer" )
242- end
243239
244240 method = methods (origKernel)[end ]
245241 args = method. sig. parameters[2 : end ]
@@ -261,6 +257,11 @@ function __build_codelet(graph::Poplar.GraphAllocated, kernel, name::String, ori
261257 input_file = joinpath (KEEP_LLVM_FILES[] ? " " : dir, " $(name) .ll" )
262258 write (input_file, llvm_ir)
263259
260+ # Do not allow references to literal pointers, which are likely to be invalid on the IPU
261+ if contains (llvm_ir, r" inttoptr +\( i64 +\d +" )
262+ error (" LLVM IR generated for codelet $(name) contains a reference to a literal pointer" )
263+ end
264+
264265 # Unless `POPC_FLAGS[]` already sets `-target`, if we have calls to Colossus
265266 # intrinsics we can't target the IPU model on CPU (the `cpu` target), so in that
266267 # case we compile only for `ipu1,ipu2`.
0 commit comments