"LinkageAttributes" decoration allow a SPIR-V module to import external functions and global variables, or export functions or global variables for other SPIR-V modules to link against and use. Import/export capability is extremely important when using outside libraries (e.g., intrinsic libraries). Added decorations: - LinkageAttributes Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D148749
20 lines
868 B
MLIR
20 lines
868 B
MLIR
// RUN: mlir-translate -no-implicit-module -test-spirv-roundtrip %s | FileCheck %s
|
|
|
|
spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Linkage], []> {
|
|
spirv.func @linkage_attr_test_kernel() "DontInline" attributes {} {
|
|
%uchar_0 = spirv.Constant 0 : i8
|
|
%ushort_1 = spirv.Constant 1 : i16
|
|
%uint_0 = spirv.Constant 0 : i32
|
|
spirv.FunctionCall @outside.func.with.linkage(%uchar_0):(i8) -> ()
|
|
spirv.Return
|
|
}
|
|
// CHECK: linkage_attributes = #spirv.linkage_attributes<linkage_name = outside.func, linkage_type = <Import>>
|
|
spirv.func @outside.func.with.linkage(%arg0 : i8) -> () "Pure" attributes {
|
|
linkage_attributes=#spirv.linkage_attributes<
|
|
linkage_name="outside.func",
|
|
linkage_type=<Import>
|
|
>
|
|
}
|
|
spirv.func @inside.func() -> () "Pure" attributes {} {spirv.Return}
|
|
}
|