llvm-project
0a88e962 - [MLIR][LLVM] Extend DIScopeForLLVMFuncOp to handle cross-file operatio… (#167844)

Commit
47 days ago
[MLIR][LLVM] Extend DIScopeForLLVMFuncOp to handle cross-file operatio… (#167844) The current `DIScopeForLLVMFuncOp` pass handles debug information for inlined code by processing `CallSiteLoc` attributes. However, some compilation scenarios compose code from multiple source files directly into a single function without generating `CallSiteLoc`. **Scenario:** ```python # a.py def kernel_a(tensor): print("a: {}", tensor) # a.py:3 jit_func_b(tensor) # Calls b.py code # b.py def func_b(tensor): print("b: {}", tensor) # b.py:7 ``` The scenario executes Python at compile-time and directly inserts operations from `b.py` into the kernel function, resulting in MLIR like: ```mlir @kernel_a(...) { print("a: {}", %arg0) loc(#loc_a) // a.py:3 print("b: {}", %arg0) loc(#loc_b) // b.py:7 <- FileLineColLoc, not CallSiteLoc } loc(#loc_kernel) // a.py:1 #loc1 = loc("a.py":3:.) #loc2 = loc("b.py":7:.) #loc_a = loc("print"(#loc1)) #loc_b = loc("print"(#loc2)) ``` ```llvm !6 = !DIFile(filename: "a.py", directory: "...") !9 = distinct !DISubprogram(name: "...", linkageName: "...", scope: !6, file: !6, line: 13, ...) !10 = !DILocation(line: 7, column: ., scope: !9) // Points to kernel's DISubprogram, not correct ```
Author
Parents
Loading