Skip to content

Commit 063342f

Browse files
committed
[SYCL] Update device_global host access decoration
The HostAccessINTEL SPIR-V decoration had an update to its identifier with https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_global_variable_host_access.asciidoc. This commit updates the identifier accordingly. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 430a3b3 commit 063342f

21 files changed

+74
-67
lines changed

llvm/lib/SYCLLowerIR/CompileTimePropertiesPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ constexpr StringRef SPIRV_PARAM_DECOR_MD_KIND = "spirv.ParameterDecorations";
3737
// The corresponding SPIR-V OpCode for the host_access property is documented
3838
// in the SPV_INTEL_global_variable_decorations design document:
3939
// https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc#decoration
40-
constexpr uint32_t SPIRV_HOST_ACCESS_DECOR = 6147;
41-
constexpr uint32_t SPIRV_HOST_ACCESS_DEFAULT_VALUE = 2; // Read/Write
40+
constexpr uint32_t SPIRV_HOST_ACCESS_DECOR = 6188;
41+
constexpr uint32_t SPIRV_HOST_ACCESS_DEFAULT_VALUE = 3; // Read/Write
4242

4343
constexpr uint32_t SPIRV_INITIATION_INTERVAL_DECOR = 5917;
4444
constexpr uint32_t SPIRV_PIPELINE_ENABLE_DECOR = 5919;

llvm/lib/SYCLLowerIR/SanitizerKernelMetadata.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ using namespace llvm;
2323
namespace llvm {
2424

2525
constexpr StringRef SPIRV_DECOR_MD_KIND = "spirv.Decorations";
26-
constexpr uint32_t SPIRV_HOST_ACCESS_DECOR = 6147;
26+
constexpr uint32_t SPIRV_HOST_ACCESS_DECOR = 6188;
2727

2828
PreservedAnalyses SanitizerKernelMetadataPass::run(Module &M,
2929
ModuleAnalysisManager &MAM) {

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ static void ExtendSpirKernelArgs(Module &M, FunctionAnalysisManager &FAM,
14601460
AsanSpirKernelMetadata->addAttribute(
14611461
"sycl-device-global-size", std::to_string(DL.getTypeAllocSize(ArrayTy)));
14621462
AsanSpirKernelMetadata->addAttribute("sycl-device-image-scope");
1463-
AsanSpirKernelMetadata->addAttribute("sycl-host-access", "0"); // read only
1463+
AsanSpirKernelMetadata->addAttribute("sycl-host-access", "1"); // read only
14641464
AsanSpirKernelMetadata->addAttribute(
14651465
"sycl-unique-id",
14661466
computeKernelMetadataUniqueId("__AsanKernelMetadata", KernelNamesBytes));

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ void MemorySanitizerOnSpirv::instrumentKernelsMetadata(int TrackOrigins) {
12651265
"sycl-device-global-size", std::to_string(DL.getTypeAllocSize(ArrayTy)));
12661266
MsanSpirKernelMetadata->addAttribute("sycl-device-image-scope");
12671267
MsanSpirKernelMetadata->addAttribute("sycl-host-access",
1268-
"0"); // read only
1268+
"1"); // read only
12691269
MsanSpirKernelMetadata->addAttribute(
12701270
"sycl-unique-id",
12711271
computeKernelMetadataUniqueId("__MsanKernelMetadata", KernelNamesBytes));

llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ void ThreadSanitizerOnSpirv::instrumentKernelsMetadata() {
719719
TsanSpirKernelMetadata->addAttribute(
720720
"sycl-device-global-size", std::to_string(DL.getTypeAllocSize(ArrayTy)));
721721
TsanSpirKernelMetadata->addAttribute("sycl-device-image-scope");
722-
TsanSpirKernelMetadata->addAttribute("sycl-host-access", "0"); // read only
722+
TsanSpirKernelMetadata->addAttribute("sycl-host-access", "1"); // read only
723723
TsanSpirKernelMetadata->addAttribute(
724724
"sycl-unique-id",
725725
computeKernelMetadataUniqueId("__TsanKernelMetadata", KernelNamesBytes));

llvm/test/Instrumentation/AddressSanitizer/SPIRV/extend_launch_info_arg.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ entry:
2525

2626
attributes #0 = { sanitize_address }
2727
;; sycl-device-global-size = 16 * 2
28-
;; sycl-host-access = 0 read-only
29-
; CHECK: attributes [[ATTR0]] = { "sycl-device-global-size"="32" "sycl-device-image-scope" "sycl-host-access"="0" "sycl-unique-id"="__AsanKernelMetadata833c47834a0b74946e370c23c39607cc" }
28+
;; sycl-host-access = 1 read-only
29+
; CHECK: attributes [[ATTR0]] = { "sycl-device-global-size"="32" "sycl-device-image-scope" "sycl-host-access"="1" "sycl-unique-id"="__AsanKernelMetadata833c47834a0b74946e370c23c39607cc" }

llvm/test/Instrumentation/MemorySanitizer/SPIRV/instrument_global_address_space.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ entry:
3131
}
3232

3333
; CHECK: attributes [[ATTR0]]
34-
; CHECK-SAME: "sycl-device-global-size"="24" "sycl-device-image-scope" "sycl-host-access"="0" "sycl-unique-id"="__MsanKernelMetadata3ff767e9a7a43f1f3968062dbb4ee3b4"
34+
; CHECK-SAME: "sycl-device-global-size"="24" "sycl-device-image-scope" "sycl-host-access"="1" "sycl-unique-id"="__MsanKernelMetadata3ff767e9a7a43f1f3968062dbb4ee3b4"

llvm/test/Instrumentation/MemorySanitizer/SPIRV/track_origins.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ entry:
3434
}
3535

3636
; CHECK: attributes [[ATTR0]]
37-
; CHECK-SAME: "sycl-device-global-size"="24" "sycl-device-image-scope" "sycl-host-access"="0" "sycl-unique-id"="__MsanKernelMetadata3ff767e9a7a43f1f3968062dbb4ee3b4"
37+
; CHECK-SAME: "sycl-device-global-size"="24" "sycl-device-image-scope" "sycl-host-access"="1" "sycl-unique-id"="__MsanKernelMetadata3ff767e9a7a43f1f3968062dbb4ee3b4"

llvm/test/SYCLLowerIR/CompileTimePropertiesPass/device-globals/test_global_variable.ll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ declare spir_func align 4 dereferenceable(4) ptr addrspace(4) @_ZNK2cl4sycl3ext6
4343
; Function Attrs: convergent mustprogress noinline norecurse nounwind optnone
4444
declare spir_func align 1 dereferenceable(1) ptr addrspace(4) @_ZNK2cl4sycl3ext6oneapi13device_globalIbJNS2_8PropertyIXadsoKcL_ZL5Name1EEEXadsoS5_L_ZL6Value1EEEEENS4_IXadsoS5_L_ZL5Name2EEEXadsoS5_L_ZL6Value2EEEEENS4_IXadsoS5_L_ZL5Name3EEEXadsoS5_L_ZL6Value3EEEEENS4_IXadsoS5_L_ZL5Name4EEEXadsoS5_L_ZL6Value4EEEEEEE3getEv(ptr addrspace(4) align 1 dereferenceable_or_null(1) %this) #4 align 2
4545

46-
attributes #0 = { "sycl-unique-id"="6da74a122db9f35d____ZL7dg_int1" "sycl-device-image-scope"="false" "sycl-host-access"="1" "sycl-implement-in-csr"="true" "sycl-init-mode"="0" "sycl-device-global-size"="4" }
46+
attributes #0 = { "sycl-unique-id"="6da74a122db9f35d____ZL7dg_int1" "sycl-device-image-scope"="false" "sycl-host-access"="2" "sycl-implement-in-csr"="true" "sycl-init-mode"="0" "sycl-device-global-size"="4" }
4747
attributes #1 = { "sycl-unique-id"="7da74a1187b9f35d____ZL7dg_int2" "sycl-implement-in-csr"="false" "sycl-init-mode"="1" "sycl-device-global-size"="4" }
48-
attributes #2 = { "sycl-unique-id"="9d329ad59055e972____ZL8dg_bool3" "sycl-device-image-scope"="true" "sycl-host-access"="0" "sycl-implement-in-csr" "sycl-init-mode"="0" "sycl-device-global-size"="1" }
49-
attributes #3 = { "sycl-unique-id"="dda2bad52c45c432____ZL8dg_bool4" "sycl-device-image-scope" "sycl-host-access"="2" "sycl-device-global-size"="1" }
48+
attributes #2 = { "sycl-unique-id"="9d329ad59055e972____ZL8dg_bool3" "sycl-device-image-scope"="true" "sycl-host-access"="1" "sycl-implement-in-csr" "sycl-init-mode"="0" "sycl-device-global-size"="1" }
49+
attributes #3 = { "sycl-unique-id"="dda2bad52c45c432____ZL8dg_bool4" "sycl-device-image-scope" "sycl-host-access"="3" "sycl-device-global-size"="1" }
5050
attributes #4 = { convergent mustprogress noinline norecurse nounwind optnone "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
5151
attributes #5 = { convergent nounwind }
5252
; no sycl-device-global-size attribute, this is not a device global variable but it contains compile-time properties,
@@ -70,18 +70,18 @@ attributes #6 = { "sycl-unique-id"="6da74a122db9f35d____ZL7no_dg_int1" "sycl-dev
7070
; CHECK-IR-DAG: ![[#MN0]] = !{![[#MN1:]], ![[#MN2:]], ![[#MN3:]]}
7171
; CHECK-IR-DAG: ![[#MN1]] = !{i32 6149, i32 1}
7272
; CHECK-IR-DAG: ![[#MN2]] = !{i32 6148, i32 0}
73-
; CHECK-IR-DAG: ![[#MN3]] = !{i32 6147, i32 1, !"6da74a122db9f35d____ZL7dg_int1"}
73+
; CHECK-IR-DAG: ![[#MN3]] = !{i32 6188, i32 2, !"6da74a122db9f35d____ZL7dg_int1"}
7474

7575
; CHECK-IR-DAG: ![[#MN4]] = !{![[#MN5:]], ![[#MN6:]], ![[#MN7:]]}
7676
; CHECK-IR-DAG: ![[#MN5]] = !{i32 6149, i32 0}
7777
; CHECK-IR-DAG: ![[#MN6]] = !{i32 6148, i32 1}
78-
; CHECK-IR-DAG: ![[#MN7]] = !{i32 6147, i32 2, !"7da74a1187b9f35d____ZL7dg_int2"}
78+
; CHECK-IR-DAG: ![[#MN7]] = !{i32 6188, i32 3, !"7da74a1187b9f35d____ZL7dg_int2"}
7979

8080
; CHECK-IR-DAG: ![[#MN8]] = !{![[#MN1]], ![[#MN2]], ![[#MN9:]]}
81-
; CHECK-IR-DAG: ![[#MN9]] = !{i32 6147, i32 0, !"9d329ad59055e972____ZL8dg_bool3"}
81+
; CHECK-IR-DAG: ![[#MN9]] = !{i32 6188, i32 1, !"9d329ad59055e972____ZL8dg_bool3"}
8282

8383
; CHECK-IR-DAG: ![[#MN10]] = !{![[#MN11:]]}
84-
; CHECK-IR-DAG: ![[#MN11]] = !{i32 6147, i32 2, !"dda2bad52c45c432____ZL8dg_bool4"}
84+
; CHECK-IR-DAG: ![[#MN11]] = !{i32 6188, i32 3, !"dda2bad52c45c432____ZL8dg_bool4"}
8585

8686
; For not a device global variable, only actually present compile-time
8787
; properties are handled

llvm/test/SYCLLowerIR/CompileTimePropertiesPass/host-pipes/basic.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ attributes #0 = { "sycl-host-pipe" "sycl-host-pipe-size"="4" "sycl-unique-id"="_
1818

1919
; Ensure that the generated metadata nodes are correct
2020
; CHECK-IR-DAG: ![[#MN0]] = !{![[#MN1:]]}
21-
; CHECK-IR-DAG: ![[#MN1]] = !{i32 6147, i32 2, !"_ZN4sycl3_V13ext5intel12experimental9host_pipeI9H2DPipeIDiNS1_6oneapi12experimental10propertiesISt5tupleIJEEEEE6__pipeE"}
21+
; CHECK-IR-DAG: ![[#MN1]] = !{i32 6188, i32 3, !"_ZN4sycl3_V13ext5intel12experimental9host_pipeI9H2DPipeIDiNS1_6oneapi12experimental10propertiesISt5tupleIJEEEEE6__pipeE"}

0 commit comments

Comments
 (0)