-
Notifications
You must be signed in to change notification settings - Fork 15
[P0] Add a lowering pattern from llvm.mlir.addressof to neura ops #287
Copy link
Copy link
Closed
Description
As @n0thingNoob described, there might be some global address pointer operations when lowering llvm dialect to neura dialect.
For example,
llvm.mlir.global external hidden unnamed_addr @run_gemv_relu_gemv.y() {addr_space = 0 : i32, alignment = 16 : i64, dso_local} : !llvm.array<4 x i32>
llvm.mlir.global external hidden unnamed_addr @run_gemv_relu_gemv.z() {addr_space = 0 : i32, alignment = 16 : i64, dso_local} : !llvm.array<4 x i32>
func.func @kernel_gemv_relu_gemv() -> (i32 {llvm.range = #llvm.constant_range<i32, 0, 256>}) attributes {CConv = #llvm.cconv<ccc>, accelerator = "neura", linkage = #llvm.linkage<external>, memory_effects = #llvm.memory_effects<other = readwrite, argMem = none, inaccessibleMem = none>, no_unwind, passthrough = ["nofree", "norecurse", "nosync", ["uwtable", "2"], ["min-legal-vector-width", "0"], ["no-trapping-math", "true"], ["stack-protector-buffer-size", "8"], ["target-cpu", "x86-64"]], target_cpu = "x86-64", target_features = #llvm.target_features<["+cmov", "+cx8", "+fxsr", "+mmx", "+sse", "+sse2", "+x87"]>, tune_cpu = "generic", unnamed_addr = 1 : i64, visibility_ = 0 : i64} {
%0 = llvm.mlir.addressof @run_gemv_relu_gemv.z : !llvm.ptr
%1 = llvm.mlir.addressof @run_gemv_relu_gemv.y : !llvm.ptr
%2 = "neura.constant"() <{value = 0 : i8}> : () -> i8
%3 = "neura.constant"() <{value = 16 : i64}> : () -> i64
%4 = "neura.constant"() <{value = 0 : i64}> : () -> i64
%5 = "neura.constant"() <{value = 0 : i32}> : () -> i32
%6 = "neura.constant"() <{value = 1 : i64}> : () -> i64
%7 = "neura.constant"() <{value = 4 : i64}> : () -> i64
%8 = "neura.constant"() <{value = 255 : i32}> : () -> i32
"neura.memset"(%1, %2, %3) <{is_volatile = false}> : (!llvm.ptr, i8, i64) -> ()
neura.br %4 : i64 to ^bb1
.....
.....We need to add a lowering pattern from llvm.mlir.addressof to neura dialect.
My initial plan is to lower such ops into neura.constant with specific attributes added.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels