[TensorIR] Pragma "import_llvm"

Hi,

is there away to use the import_llvm pragma in TensorIR similarly how it can used in TE?

s[result].pragma(axis[0], "import_llvm", clang.create_llvm(cc_code, output=ll_path))

@junrushao @areusch @Hzfengsy

I’m not sure but you can try to use

s.annotate(loop, "import_llvm", clang.create_llvm(cc_code, output=ll_path))

Genernally, it’s just an attr on the IR, so we should be able to do the same thing.

if the goal is to inject some microkernels, tensorize is definitely the most canonical approach tho :slight_smile:

I think this is s.annotate(loop, "pragma_import_llvm", clang.create_llvm(cc_code, output=ll_path))

There is a convention of prefix “pragma_” for te primitive.

1 Like

Thanks. That’s correct. Just also figured it out :).

As @wrongtest, mentioned the codegen checks for "pragma_import_llvm"

Got it working like this

CC: @Hzfengsy @junrushao @SebastianBoblestETAS @UlrikHjort @aca88