From 67f3f0a8368d9bb8be6965bb4d5d8aecc68f24b4 Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Tue, 28 Nov 2023 13:32:31 -0800 Subject: [PATCH 1/3] Abort testing on unsupported dialect flags --- libcudacxx/test/utils/libcudacxx/test/config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libcudacxx/test/utils/libcudacxx/test/config.py b/libcudacxx/test/utils/libcudacxx/test/config.py index 8c598904415..9d44a1263e7 100644 --- a/libcudacxx/test/utils/libcudacxx/test/config.py +++ b/libcudacxx/test/utils/libcudacxx/test/config.py @@ -765,6 +765,11 @@ def configure_default_compile_flags(self): self.cxx.compile_flags += ['/std:{0}'.format(std)] else: self.cxx.compile_flags += ['-std={0}'.format(std)] + + # Do a check with a user/config flag to ensure that the flag is supported. + if not self.cxx.hasCompileFlag(self.cxx.compile_flags): + raise OSError("Configured compiler does not support flag {0}".format(self.cxx.compile_flags)) + if not std: # There is no dialect flag. This happens with older MSVC. if self.cxx.type == 'nvcc': From 7bff6ebe4816a2b0e8ed8596ab97a7246097db08 Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Tue, 28 Nov 2023 14:10:30 -0800 Subject: [PATCH 2/3] Fix dialect testing check in clang-cuda. --- libcudacxx/test/utils/libcudacxx/test/config.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libcudacxx/test/utils/libcudacxx/test/config.py b/libcudacxx/test/utils/libcudacxx/test/config.py index 9d44a1263e7..abf380e894f 100644 --- a/libcudacxx/test/utils/libcudacxx/test/config.py +++ b/libcudacxx/test/utils/libcudacxx/test/config.py @@ -708,6 +708,8 @@ def configure_compile_flags(self): def configure_default_compile_flags(self): nvcc_host_compiler = self.get_lit_conf('nvcc_host_compiler') + cxx_additional_flags = self.get_lit_conf('test_compiler_flags') + if nvcc_host_compiler and self.cxx.type == 'nvcc': self.cxx.compile_flags += ['-ccbin={0}'.format(nvcc_host_compiler)] @@ -761,14 +763,15 @@ def configure_default_compile_flags(self): if std: # We found a dialect flag. + stdflag = '-std={0}'.format(std) if self.cxx.type == 'msvc': - self.cxx.compile_flags += ['/std:{0}'.format(std)] - else: - self.cxx.compile_flags += ['-std={0}'.format(std)] + stdflag = '/std:{0}'.format(std) + + # Do a check with the user/config flag to ensure that the flag is supported. + if not self.cxx.hasCompileFlag([stdflag] + cxx_additional_flags.split(' ')): + raise OSError("Configured compiler does not support flag {0}".format(stdflag)) - # Do a check with a user/config flag to ensure that the flag is supported. - if not self.cxx.hasCompileFlag(self.cxx.compile_flags): - raise OSError("Configured compiler does not support flag {0}".format(self.cxx.compile_flags)) + self.cxx.flags += [stdflag] if not std: # There is no dialect flag. This happens with older MSVC. From 4749e28780df03ddf5f2abbdd9eb8884d1a8a156 Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Tue, 28 Nov 2023 15:21:46 -0800 Subject: [PATCH 3/3] Revert injecting flags from CMake, make a special case for clang-cuda. --- libcudacxx/test/utils/libcudacxx/test/config.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libcudacxx/test/utils/libcudacxx/test/config.py b/libcudacxx/test/utils/libcudacxx/test/config.py index abf380e894f..bd55a9c5798 100644 --- a/libcudacxx/test/utils/libcudacxx/test/config.py +++ b/libcudacxx/test/utils/libcudacxx/test/config.py @@ -708,7 +708,6 @@ def configure_compile_flags(self): def configure_default_compile_flags(self): nvcc_host_compiler = self.get_lit_conf('nvcc_host_compiler') - cxx_additional_flags = self.get_lit_conf('test_compiler_flags') if nvcc_host_compiler and self.cxx.type == 'nvcc': self.cxx.compile_flags += ['-ccbin={0}'.format(nvcc_host_compiler)] @@ -767,8 +766,12 @@ def configure_default_compile_flags(self): if self.cxx.type == 'msvc': stdflag = '/std:{0}'.format(std) + extraflags = [] + if self.cxx.type == 'clang': + extraflags = ['-Wno-unknown-cuda-version'] + # Do a check with the user/config flag to ensure that the flag is supported. - if not self.cxx.hasCompileFlag([stdflag] + cxx_additional_flags.split(' ')): + if not self.cxx.hasCompileFlag([stdflag] + extraflags): raise OSError("Configured compiler does not support flag {0}".format(stdflag)) self.cxx.flags += [stdflag]