Skip to content

Commit

Permalink
[SYCLomatic] Fix incorrect migration for option "-Xcompiler" and thre…
Browse files Browse the repository at this point in the history
…e cuda specific options (#2134)


Signed-off-by: chenwei.sun <[email protected]>
  • Loading branch information
tomflinda authored Jul 8, 2024
1 parent cfe79b7 commit 41cab0d
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clang/test/dpct/cmake_migration/case_055/expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ set(SYCL_HOST_FLAGS "--extra-warnings -Wdeprecated")
set (SYCL_HOST_FLAGS "--extra-warnings -Wdeprecated")

set(SYCL_HOST_FLAGS "${host_flags}")

list(APPEND CMAKE_SYCL_FLAGS "-Wno-float-conversion")
list(APPEND CMAKE_SYCL_FLAGS "-fno-strict-aliasing")
list(APPEND CMAKE_SYCL_FLAGS "")
list(APPEND CMAKE_SYCL_FLAGS "")
list(APPEND CMAKE_SYCL_FLAGS "")
6 changes: 6 additions & 0 deletions clang/test/dpct/cmake_migration/case_055/input.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ set(CUDA_HOST_FLAGS "--extra-warnings -Wdeprecated")
set (CUDA_HOST_FLAGS "--extra-warnings -Wdeprecated")

set(CUDA_HOST_FLAGS "${host_flags}")

list(APPEND CMAKE_CUDA_FLAGS "-Xcompiler=-Wno-float-conversion")
list(APPEND CMAKE_CUDA_FLAGS "-Xcompiler=-fno-strict-aliasing")
list(APPEND CMAKE_CUDA_FLAGS "-Xcudafe=--diag_suppress=unrecognized_gcc_pragma")
list(APPEND CMAKE_CUDA_FLAGS "--extended-lambda")
list(APPEND CMAKE_CUDA_FLAGS "--expt-relaxed-constexpr")
48 changes: 48 additions & 0 deletions clang/tools/dpct/DpctOptRules/cmake_script_migration_rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2571,3 +2571,51 @@
MatchMode: Full
In: CMAKE_CUDA_COMPILER_VERSION
Out: COMPATIBILITY_VERSION

- Rule: rule_xcompiler_option_filter
Kind: CMakeRule
Priority: Fallback
CmakeSyntax: xcompiler_option_filter
In: ${func_name}(${value})
Out: ${func_name}(${value})
Subrules:
value:
MatchMode: Full
In: -Xcompiler=${arg}
Out: ${arg}

- Rule: rule_xcudafe_filter
Kind: CMakeRule
Priority: Fallback
CmakeSyntax: xcudafe_filter
In: ${func_name}(${value})
Out: ${func_name}(${value})
Subrules:
value:
MatchMode: Full
In: -Xcudafe=${arg}
Out: ""

- Rule: rule_extended_lambda_remove
Kind: CMakeRule
Priority: Fallback
CmakeSyntax: extended_lambda_remove
In: ${func_name}(${value})
Out: ${func_name}(${value})
Subrules:
value:
MatchMode: Full
In: --extended-lambda
Out: ""

- Rule: rule_expt_relaxed_constexpr_remove
Kind: CMakeRule
Priority: Fallback
CmakeSyntax: expt_relaxed_constexpr_remove
In: ${func_name}(${value})
Out: ${func_name}(${value})
Subrules:
value:
MatchMode: Full
In: --expt-relaxed-constexpr
Out: ""

0 comments on commit 41cab0d

Please sign in to comment.