Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL][NATIVECPU][LIBCLC] Use libclc for SYCL Native CPU #10970

Merged
merged 35 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a7d2f64
[WIP] use CUDA addrspace map for native cpu
PietroGhg Aug 10, 2023
1166a9c
materialize cast spirv intrinsic
PietroGhg Aug 11, 2023
5838817
use new option for addrspace map
PietroGhg Aug 14, 2023
5b39367
update lit tests
PietroGhg Aug 14, 2023
967d049
[wip] build libclc when native cpu is set
PietroGhg Aug 14, 2023
bcb4387
[wip] temporary disable builtins that raise compiler error
PietroGhg Aug 14, 2023
142cc11
link libclc from driver
PietroGhg Aug 14, 2023
fde2775
update tests
PietroGhg Aug 14, 2023
2e9a3c4
use -fsycl-is-native-cpu for addrspace map
PietroGhg Aug 15, 2023
9557708
(SYCLNATIVECPU) initial GlobalTimeStamp impl
uwedolinsky Aug 15, 2023
1a31089
(SYCLNATIVECPU) removed unneeded UR_ASSERTS
uwedolinsky Aug 15, 2023
976782d
Merge branch 'uwe/piur_updates' into pietro/addrspace_map
PietroGhg Aug 16, 2023
7f204f8
add impl for atomicload helpers
PietroGhg Aug 17, 2023
6f624a5
avoid emitting genericcast builtins on native cpu
PietroGhg Aug 17, 2023
79a22d1
don't raise error for nativecpu state
PietroGhg Aug 18, 2023
242d267
Revert "[wip] temporary disable builtins that raise compiler error"
PietroGhg Aug 18, 2023
3b28155
disable unsupported builtins
PietroGhg Aug 18, 2023
7090312
Merge branch 'sycl' into pietro/addrspace_map
PietroGhg Aug 18, 2023
f3e7641
fix post merge
PietroGhg Aug 18, 2023
e627b1e
Address review comments
PietroGhg Aug 22, 2023
7e27dfa
formatting
PietroGhg Aug 22, 2023
b6e0684
Review comments
PietroGhg Aug 23, 2023
df09d29
move loadstore_helpers.ll
PietroGhg Aug 23, 2023
acbe84f
split loadstore_helpers module
PietroGhg Aug 25, 2023
8e99685
update docs and comments
PietroGhg Aug 25, 2023
7e5d66d
formatting
PietroGhg Aug 25, 2023
8f4f95a
fix comments in llvm ir
PietroGhg Aug 25, 2023
07579b8
Use -fsycl-libspirv in lit test
PietroGhg Aug 28, 2023
3d8135f
Merge branch 'sycl' into pietro/addrspace_map
PietroGhg Aug 29, 2023
e399d62
Merge branch 'sycl' into pietro/addrspace_map
PietroGhg Sep 4, 2023
b694fda
formatting
PietroGhg Sep 4, 2023
41caf3d
Fix comment style
PietroGhg Sep 5, 2023
612423b
Merge branch 'sycl' into pietro/addrspace_map
PietroGhg Sep 5, 2023
2d88c3b
Handle not linking libclc on native cpu
PietroGhg Sep 6, 2023
e49b27c
Merge branch 'sycl' into pietro/addrspace_map
PietroGhg Sep 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion buildbot/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def do_configure(args):
if args.enable_esimd_emulator:
sycl_enabled_plugins.append("esimd_emulator")

if args.cuda or args.hip:
if args.cuda or args.hip or args.native_cpu:
llvm_enable_projects += ';libclc'

if args.cuda:
Expand All @@ -87,6 +87,12 @@ def do_configure(args):
sycl_build_pi_hip_platform = args.hip_platform
sycl_enabled_plugins.append("hip")

if args.native_cpu:
#Todo: we should set whatever targets we support for native cpu
libclc_targets_to_build += ';x86_64-unknown-linux-gnu'
sycl_enabled_plugins.append("native_cpu")


# all llvm compiler targets don't require 3rd party dependencies, so can be
# built/tested even if specific runtimes are not available
if args.enable_all_llvm_targets:
Expand Down Expand Up @@ -234,6 +240,7 @@ def main():
parser.add_argument("-t", "--build-type",
metavar="BUILD_TYPE", default="Release", help="build type: Debug, Release")
parser.add_argument("--cuda", action='store_true', help="switch from OpenCL to CUDA")
parser.add_argument("--native_cpu", action='store_true', help="Enable SYCL Native CPU")
parser.add_argument("--hip", action='store_true', help="switch from OpenCL to HIP")
parser.add_argument("--hip-platform", type=str, choices=['AMD', 'NVIDIA'], default='AMD', help="choose hardware platform for HIP backend")
parser.add_argument("--host-target", default='X86',
Expand Down
32 changes: 32 additions & 0 deletions clang/lib/Basic/TargetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,38 @@ void TargetInfo::adjust(DiagnosticsEngine &Diags, LangOptions &Opts) {

if (Opts.FakeAddressSpaceMap)
AddrSpaceMap = &FakeAddrSpaceMap;

if (Opts.SYCLIsDevice && Opts.SYCLIsNativeCPU) {
// For SYCL Native CPU we use the NVPTXAddrSpaceMap because
// we need builtins to be mangled with AS information

static const unsigned SYCLNativeCPUASMap[] = {
0, // Default
1, // opencl_global
3, // opencl_local
4, // opencl_constant
0, // opencl_private
0, // opencl_generic
1, // opencl_global_device
1, // opencl_global_host
1, // cuda_device
4, // cuda_constant
3, // cuda_shared
1, // sycl_global
1, // sycl_global_device
1, // sycl_global_host
3, // sycl_local
0, // sycl_private
0, // ptr32_sptr
0, // ptr32_uptr
0, // ptr64
0, // hlsl_groupshared
20, // wasm_funcref
};

AddrSpaceMap = &SYCLNativeCPUASMap;
UseAddrSpaceMapMangling = true;
}
}

bool TargetInfo::initFeatureMap(
Expand Down
49 changes: 49 additions & 0 deletions clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5309,6 +5309,52 @@ class OffloadingActionBuilder final {
return needLibs;
}

bool addSYCLNativeCPULibs(const ToolChain *TC,
ActionList &DeviceLinkObjects) {
std::string LibSpirvFile;
if (Args.hasArg(options::OPT_fsycl_libspirv_path_EQ)) {
auto ProvidedPath =
Args.getLastArgValue(options::OPT_fsycl_libspirv_path_EQ).str();
if (llvm::sys::fs::exists(ProvidedPath))
LibSpirvFile = ProvidedPath;
} else {
SmallVector<StringRef, 8> LibraryPaths;

// Expected path w/out install.
SmallString<256> WithoutInstallPath(C.getDriver().ResourceDir);
llvm::sys::path::append(WithoutInstallPath, Twine("../../clc"));
LibraryPaths.emplace_back(WithoutInstallPath.c_str());

// Expected path w/ install.
SmallString<256> WithInstallPath(C.getDriver().ResourceDir);
llvm::sys::path::append(WithInstallPath, Twine("../../../share/clc"));
LibraryPaths.emplace_back(WithInstallPath.c_str());

// Select libclc variant based on target triple
std::string LibSpirvTargetName = "builtins.link.libspirv-";
LibSpirvTargetName.append(TC->getTripleString() + ".bc");

for (StringRef LibraryPath : LibraryPaths) {
SmallString<128> LibSpirvTargetFile(LibraryPath);
llvm::sys::path::append(LibSpirvTargetFile, LibSpirvTargetName);
if (llvm::sys::fs::exists(LibSpirvTargetFile) ||
Args.hasArg(options::OPT__HASH_HASH_HASH)) {
LibSpirvFile = std::string(LibSpirvTargetFile.str());
break;
}
}
}

if (!LibSpirvFile.empty()) {
Arg *LibClcInputArg = MakeInputArg(Args, C.getDriver().getOpts(),
Args.MakeArgString(LibSpirvFile));
auto *SYCLLibClcInputAction =
C.MakeAction<InputAction>(*LibClcInputArg, types::TY_LLVM_BC);
DeviceLinkObjects.push_back(SYCLLibClcInputAction);
}
return true;
bader marked this conversation as resolved.
Show resolved Hide resolved
}

bool addSYCLDeviceLibs(const ToolChain *TC, ActionList &DeviceLinkObjects,
bool isSpirvAOT, bool isMSVCEnv) {
struct DeviceLibOptInfo {
Expand Down Expand Up @@ -5719,6 +5765,9 @@ class OffloadingActionBuilder final {
TC, DeviceLibs, UseAOTLink,
C.getDefaultToolChain().getTriple().isWindowsMSVCEnvironment());
}
if (isSYCLNativeCPU) {
SYCLDeviceLibLinked = addSYCLNativeCPULibs(TC, DeviceLibs);
bader marked this conversation as resolved.
Show resolved Hide resolved
}
JobAction *LinkSYCLLibs =
C.MakeAction<LinkJobAction>(DeviceLibs, types::TY_LLVM_BC);
for (Action *FullLinkObject : FullLinkObjects) {
Expand Down
9 changes: 7 additions & 2 deletions clang/lib/Driver/ToolChains/SYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "SYCL.h"
#include "CommonArgs.h"
#include "clang/Driver/Action.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/DriverDiagnostic.h"
Expand Down Expand Up @@ -170,6 +171,8 @@ const char *SYCL::Linker::constructLLVMLinkCommand(
// instead of the original object.
if (JA.isDeviceOffloading(Action::OFK_SYCL)) {
bool IsRDC = !shouldDoPerObjectFileLinking(C);
const bool IsSYCLNativeCPU = isSYCLNativeCPU(
this->getToolChain(), *C.getSingleOffloadToolChain<Action::OFK_Host>());
auto isNoRDCDeviceCodeLink = [&](const InputInfo &II) {
if (IsRDC)
return false;
Expand All @@ -190,12 +193,14 @@ const char *SYCL::Linker::constructLLVMLinkCommand(

std::string FileName = this->getToolChain().getInputFilename(II);
StringRef InputFilename = llvm::sys::path::filename(FileName);
if (this->getToolChain().getTriple().isNVPTX()) {
const bool IsNVPTX = this->getToolChain().getTriple().isNVPTX();
if (IsNVPTX || IsSYCLNativeCPU) {
// Linking SYCL Device libs requires libclc as well as libdevice
if ((InputFilename.find("libspirv") != InputFilename.npos ||
InputFilename.find("libdevice") != InputFilename.npos))
return true;
LibPostfix = ".cubin";
if (IsNVPTX)
LibPostfix = ".cubin";
}
StringRef LibSyclPrefix("libsycl-");
if (!InputFilename.startswith(LibSyclPrefix) ||
Expand Down
46 changes: 17 additions & 29 deletions clang/test/Driver/sycl-native-cpu-fsycl.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//RUN: %clang -fsycl -fsycl-targets=native_cpu -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=CHECK_ACTIONS
//RUN: %clang -fsycl -fsycl-targets=native_cpu -ccc-print-bindings %s 2>&1 | FileCheck %s --check-prefix=CHECK_BINDINGS
//RUN: %clang -fsycl -fsycl-targets=native_cpu -### %s 2>&1 | FileCheck %s --check-prefix=CHECK_INVO
//RUN: %clang -fsycl -fsycl-targets=native_cpu -target aarch64-unknown-linux-gnu -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=CHECK_ACTIONS-AARCH64
//RUN: %clang -fsycl -fsycl-targets=native_cpu -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=CHECK_ACTIONS
//RUN: %clang -fsycl -fsycl-targets=native_cpu -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -ccc-print-bindings %s 2>&1 | FileCheck %s --check-prefix=CHECK_BINDINGS
//RUN: %clang -fsycl -fsycl-targets=native_cpu -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -### %s 2>&1 | FileCheck %s --check-prefix=CHECK_INVO
//RUN: %clang -fsycl -fsycl-targets=native_cpu -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc -target aarch64-unknown-linux-gnu -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=CHECK_ACTIONS-AARCH64


//CHECK_ACTIONS: +- 0: input, "{{.*}}sycl-native-cpu-fsycl.cpp", c++, (host-sycl)
Expand All @@ -15,20 +15,23 @@
//CHECK_ACTIONS: +- 8: backend, {7}, assembler, (host-sycl)
//CHECK_ACTIONS: +- 9: assembler, {8}, object, (host-sycl)
//CHECK_ACTIONS:+- 10: linker, {9}, image, (host-sycl)
//CHECK_ACTIONS: +- 11: linker, {5}, ir, (device-sycl)
//CHECK_ACTIONS: |- 12: input, "{{.*}}libspirv{{.*}}", ir, (device-sycl)
//CHECK_ACTIONS: +- 13: linker, {11, 12}, ir, (device-sycl)
//this is where we compile the device code to a shared lib, and we link the host shared lib and the device shared lib
//CHECK_ACTIONS:| +- 11: linker, {5}, ir, (device-sycl)
//CHECK_ACTIONS:| +- 12: backend, {11}, assembler, (device-sycl)
//CHECK_ACTIONS:|- 13: assembler, {12}, object, (device-sycl)
//CHECK_ACTIONS:| +- 14: backend, {13}, assembler, (device-sycl)
//CHECK_ACTIONS:|- 15: assembler, {14}, object, (device-sycl)
//call sycl-post-link and clang-offload-wrapper
//CHECK_ACTIONS:| +- 14: sycl-post-link, {11}, tempfiletable, (device-sycl)
//CHECK_ACTIONS:|- 15: clang-offload-wrapper, {14}, object, (device-sycl)
//CHECK_ACTIONS:16: offload, "host-sycl ({{.*}})" {10}, "device-sycl ({{.*}})" {13}, "device-sycl ({{.*}})" {15}, image
//CHECK_ACTIONS:| +- 16: sycl-post-link, {13}, tempfiletable, (device-sycl)
//CHECK_ACTIONS:|- 17: clang-offload-wrapper, {16}, object, (device-sycl)
//CHECK_ACTIONS:18: offload, "host-sycl ({{.*}})" {10}, "device-sycl ({{.*}})" {15}, "device-sycl ({{.*}})" {17}, image


//CHECK_BINDINGS:# "{{.*}}" - "clang", inputs: ["{{.*}}sycl-native-cpu-fsycl.cpp"], output: "[[KERNELIR:.*]].bc"
//CHECK_BINDINGS:# "{{.*}}" - "SYCL::Linker", inputs: ["[[KERNELIR]].bc"], output: "[[KERNELLINK:.*]].bc"
//CHECK_BINDINGS:# "{{.*}}" - "clang", inputs: ["[[KERNELLINK]].bc"], output: "[[KERNELOBJ:.*]].o"
//CHECK_BINDINGS:# "{{.*}}" - "SYCL post link", inputs: ["[[KERNELLINK]].bc"], output: "[[TABLEFILE:.*]].table"
//CHECK_BINDINGS:# "{{.*}}" - "SYCL::Linker", inputs: ["[[KERNELLINK]].bc", "{{.*}}.bc"], output: "[[KERNELLINKWLIB:.*]].bc"
//CHECK_BINDINGS:# "{{.*}}" - "clang", inputs: ["[[KERNELLINKWLIB]].bc"], output: "[[KERNELOBJ:.*]].o"
//CHECK_BINDINGS:# "{{.*}}" - "SYCL post link", inputs: ["[[KERNELLINKWLIB]].bc"], output: "[[TABLEFILE:.*]].table"
//CHECK_BINDINGS:# "{{.*}}" - "offload wrapper", inputs: ["[[TABLEFILE]].table"], output: "[[WRAPPEROBJ:.*]].o"
//CHECK_BINDINGS:# "{{.*}}" - "Append Footer to source", inputs: ["{{.*}}sycl-native-cpu-fsycl.cpp"], output: "[[SRCWFOOTER:.*]].cpp"
//CHECK_BINDINGS:# "{{.*}}" - "clang", inputs: ["[[SRCWFOOTER]].cpp", "[[KERNELIR]].bc"], output: "[[HOSTOBJ:.*]].o"
Expand All @@ -38,21 +41,6 @@
//CHECK_INVO:{{.*}}clang{{.*}}"-x" "ir"
//CHECK_INVO:{{.*}}clang{{.*}}"-fsycl-is-host"{{.*}}

// checkes that the device and host triple is correct in the generated actions when it is set explicitly
//CHECK_ACTIONS-AARCH64: +- 0: input, "{{.*}}sycl-native-cpu-fsycl.cpp", c++, (host-sycl)
//CHECK_ACTIONS-AARCH64: +- 1: append-footer, {0}, c++, (host-sycl)
//CHECK_ACTIONS-AARCH64: +- 2: preprocessor, {1}, c++-cpp-output, (host-sycl)
//CHECK_ACTIONS-AARCH64: | +- 3: input, "{{.*}}sycl-native-cpu-fsycl.cpp", c++, (device-sycl)
//CHECK_ACTIONS-AARCH64: | +- 4: preprocessor, {3}, c++-cpp-output, (device-sycl)
//CHECK_ACTIONS-AARCH64: |- 5: compiler, {4}, ir, (device-sycl)
// checks that the device and host triple is correct in the generated actions when it is set explicitly
//CHECK_ACTIONS-AARCH64: +- 6: offload, "host-sycl (aarch64-unknown-linux-gnu)" {2}, "device-sycl (aarch64-unknown-linux-gnu)" {5}, c++-cpp-output
//CHECK_ACTIONS-AARCH64: +- 7: compiler, {6}, ir, (host-sycl)
//CHECK_ACTIONS-AARCH64: +- 8: backend, {7}, assembler, (host-sycl)
//CHECK_ACTIONS-AARCH64: +- 9: assembler, {8}, object, (host-sycl)
//CHECK_ACTIONS-AARCH64:+- 10: linker, {9}, image, (host-sycl)
//CHECK_ACTIONS-AARCH64:| +- 11: linker, {5}, ir, (device-sycl)
//CHECK_ACTIONS-AARCH64:| +- 12: backend, {11}, assembler, (device-sycl)
//CHECK_ACTIONS-AARCH64:|- 13: assembler, {12}, object, (device-sycl)
//CHECK_ACTIONS-AARCH64:| +- 14: sycl-post-link, {11}, tempfiletable, (device-sycl)
//CHECK_ACTIONS-AARCH64:|- 15: clang-offload-wrapper, {14}, object, (device-sycl)
//CHECK_ACTIONS-AARCH64:16: offload, "host-sycl (aarch64-unknown-linux-gnu)" {10}, "device-sycl (aarch64-unknown-linux-gnu)" {13}, "device-sycl (aarch64-unknown-linux-gnu)" {15}, image
//CHECK_ACTIONS-AARCH64:{{[0-9]*}}: offload, "host-sycl (aarch64-unknown-linux-gnu)" {{{[0-9]*}}}, "device-sycl (aarch64-unknown-linux-gnu)" {{{[0-9]*}}}, "device-sycl (aarch64-unknown-linux-gnu)" {{{[0-9]*}}}, image
6 changes: 6 additions & 0 deletions libclc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ set( nvptx--nvidiacl_devices none )
set( nvptx64--nvidiacl_devices none )
set( spirv-mesa3d-_devices none )
set( spirv64-mesa3d-_devices none )
# todo: does this need to be set for each possible triple?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the comment formatting used throughout the rest of the file. I.e.

Suggested change
# todo: does this need to be set for each possible triple?
# TODO: Does this need to be set for each possible triple?

set( x86_64-unknown-linux-gnu_devices none )

# Setup aliases
set( cedar_aliases palm sumo sumo2 redwood juniper )
Expand Down Expand Up @@ -342,6 +344,10 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
# AMDGCN needs libclc to be compiled to high bc version since all atomic
# clang builtins need to be accessible
set( flags "SHELL:-mcpu=gfx940")
elseif( ${ARCH} STREQUAL x86_64)
# todo: this is used by native cpu, we should define an option to set this flags
set( flags "SHELL:-Xclang -target-feature -Xclang +avx"
"SHELL:-Xclang -target-feature -Xclang +avx512f")
else()
set ( flags )
endif()
Expand Down
4 changes: 4 additions & 0 deletions libclc/generic/libspirv/SOURCES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
atomic/loadstore_helpers_unordered.ll
atomic/loadstore_helpers_release.ll
atomic/loadstore_helpers_acquire.ll
atomic/loadstore_helpers_seq_cst.ll
float16.cl
subnormal_config.cl
subnormal_helper_func.ll
Expand Down
58 changes: 58 additions & 0 deletions libclc/generic/libspirv/atomic/loadstore_helpers_acquire.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#if __clang_major__ >= 7
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
#else
target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
#endif
; This file contains helper functions for the acquire memory ordering constraint.
; Other targets can specialize this file to account for unsupported features in their backend.

declare void @llvm.trap()

define i32 @__clc__atomic_load_global_4_acquire(i32 addrspace(1)* nocapture %ptr) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

define i32 @__clc__atomic_load_local_4_acquire(i32 addrspace(3)* nocapture %ptr) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

define i64 @__clc__atomic_load_global_8_acquire(i64 addrspace(1)* nocapture %ptr) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

define i64 @__clc__atomic_load_local_8_acquire(i64 addrspace(3)* nocapture %ptr) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

define i32 @__clc__atomic_uload_global_4_acquire(i32 addrspace(1)* nocapture %ptr) nounwind alwaysinline {
entry:
%0 = load atomic volatile i32, i32 addrspace(1)* %ptr acquire, align 4
ret i32 %0
}

define i32 @__clc__atomic_uload_local_4_acquire(i32 addrspace(3)* nocapture %ptr) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

define i64 @__clc__atomic_uload_global_8_acquire(i64 addrspace(1)* nocapture %ptr) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

define i64 @__clc__atomic_uload_local_8_acquire(i64 addrspace(3)* nocapture %ptr) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

58 changes: 58 additions & 0 deletions libclc/generic/libspirv/atomic/loadstore_helpers_release.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#if __clang_major__ >= 7
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
#else
target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
#endif
; This file contains helper functions for the release memory ordering constraint.
; Other targets can specialize this file to account for unsupported features in their backend.

declare void @llvm.trap()

define void @__clc__atomic_store_global_4_release(i32 addrspace(1)* nocapture %ptr, i32 %value) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

define void @__clc__atomic_store_local_4_release(i32 addrspace(3)* nocapture %ptr, i32 %value) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

define void @__clc__atomic_store_global_8_release(i64 addrspace(1)* nocapture %ptr, i64 %value) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

define void @__clc__atomic_store_local_8_release(i64 addrspace(3)* nocapture %ptr, i64 %value) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

define void @__clc__atomic_ustore_global_4_release(i32 addrspace(1)* nocapture %ptr, i32 %value) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

define void @__clc__atomic_ustore_local_4_release(i32 addrspace(3)* nocapture %ptr, i32 %value) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

define void @__clc__atomic_ustore_global_8_release(i64 addrspace(1)* nocapture %ptr, i64 %value) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

define void @__clc__atomic_ustore_local_8_release(i64 addrspace(3)* nocapture %ptr, i64 %value) nounwind alwaysinline {
entry:
tail call void @llvm.trap()
unreachable
}

Loading