summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/TripleTest.cpp
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2016-09-23 00:42:56 +0000
committerTom Stellard <thomas.stellard@amd.com>2016-09-23 00:42:56 +0000
commite190cd28340360a4526754185d22c3972878be79 (patch)
tree82d4a8ae90ef7535da766316df57501aec0f35be /llvm/unittests/ADT/TripleTest.cpp
parent2f4ac44dc30e8c718db7b56ce3f745fb3b5dec55 (diff)
downloadbcm5719-llvm-e190cd28340360a4526754185d22c3972878be79.tar.gz
bcm5719-llvm-e190cd28340360a4526754185d22c3972878be79.zip
Triple: Add opencl environment type
Summary: For AMDGPU, we have been using the operating system component of the triple for specifying the low-level runtime that is being used. The rationale for this is that the host operating system (e.g. Linux) is irrelevant for GPU code, since its execution enviroment will be mostly controled by the low-level runtime being used to execute the code. In most cases, higher level languages have their own runtime which is implemented on top of the low-level runtime. The kernel ABIs of each language mostly depend on the low-level runtime, but there may be some slight differences between languages. OpenCL for example, may append additional arguments to the kernel in order to pass values like global offsets or buffers for printf. OpenMP, HCC, or other languages may want to add their own values which differ from OpenCL. The reason for adding a new opencl environment type is to make it possible for the backend to distinguish between the ABIs of the higher-level languages and handle them correctly. It seems cleaner to use the enviroment component for this rather than creating a new OS type for every combination of low-level runtime / high-level language. Reviewers: Anastasia, chandlerc Subscribers: whchung, pekka.jaaskelainen, wdng, yaxunl, llvm-commits Differential Revision: https://reviews.llvm.org/D24735 llvm-svn: 282218
Diffstat (limited to 'llvm/unittests/ADT/TripleTest.cpp')
-rw-r--r--llvm/unittests/ADT/TripleTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp
index d6f3dfec406..8d0539a118c 100644
--- a/llvm/unittests/ADT/TripleTest.cpp
+++ b/llvm/unittests/ADT/TripleTest.cpp
@@ -248,6 +248,12 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::AMDHSA, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+ T = Triple("amdgcn-amd-amdhsa-opencl");
+ EXPECT_EQ(Triple::amdgcn, T.getArch());
+ EXPECT_EQ(Triple::AMD, T.getVendor());
+ EXPECT_EQ(Triple::AMDHSA, T.getOS());
+ EXPECT_EQ(Triple::OpenCL, T.getEnvironment());
+
T = Triple("huh");
EXPECT_EQ(Triple::UnknownArch, T.getArch());
}
OpenPOWER on IntegriCloud