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

[SYCLomatic][CMake] Add migration of CUDA specific option "--use_fast_math" and "-use_fast_math" #2014

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: rm -rf %T && mkdir -p %T
// RUN: cd %T
// RUN: cp %S/input.cmake ./input.cmake
// RUN: dpct -in-root ./ -out-root out ./input.cmake --migrate-build-script-only
// RUN: echo "begin" > %T/diff.txt
// RUN: diff --strip-trailing-cr %S/expected.txt %T/out/input.cmake >> %T/diff.txt
// RUN: echo "end" >> %T/diff.txt

// CHECK: begin
// CHECK-NEXT: end
13 changes: 13 additions & 0 deletions clang/test/dpct/cmake_migration/case_045/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Compiler options
set_source_files_properties(fused_softmax/scaled_masked_softmax.dp.cpp
fused_softmax/scaled_upper_triang_masked_softmax.dp.cpp
fused_softmax/scaled_aligned_causal_masked_softmax.dp.cpp
PROPERTIES
COMPILE_OPTIONS "-ffast-math")

# Compiler options
set_source_files_properties(fused_softmax/scaled_masked_softmax.dp.cpp
fused_softmax/scaled_upper_triang_masked_softmax.dp.cpp
fused_softmax/scaled_aligned_causal_masked_softmax.dp.cpp
PROPERTIES
COMPILE_OPTIONS "-ffast-math")
13 changes: 13 additions & 0 deletions clang/test/dpct/cmake_migration/case_045/input.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Compiler options
set_source_files_properties(fused_softmax/scaled_masked_softmax.cu
fused_softmax/scaled_upper_triang_masked_softmax.cu
fused_softmax/scaled_aligned_causal_masked_softmax.cu
PROPERTIES
COMPILE_OPTIONS "--use_fast_math")

# Compiler options
set_source_files_properties(fused_softmax/scaled_masked_softmax.cu
fused_softmax/scaled_upper_triang_masked_softmax.cu
fused_softmax/scaled_aligned_causal_masked_softmax.cu
PROPERTIES
COMPILE_OPTIONS "-use_fast_math")
28 changes: 27 additions & 1 deletion clang/tools/dpct/DpctOptRules/cmake_script_migration_rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2538,4 +2538,30 @@
MatchMode: Full
In: cuda
Out: ""
RuleId: "remove_lib_cuda"
RuleId: "remove_lib_cuda"

- Rule: rule_use_fast_math_one_dash
Kind: CMakeRule
Priority: Fallback
MatchMode: Partial
CmakeSyntax: use_fast_math_one_dash
In: ${func_name}(${value})
Out: ${func_name}(${value})
Subrules:
value:
MatchMode: Full
In: -use_fast_math
Out: -ffast-math

- Rule: rule_use_fast_math_two_dash
Kind: CMakeRule
Priority: Fallback
MatchMode: Partial
CmakeSyntax: use_fast_math_two_dash
In: ${func_name}(${value})
Out: ${func_name}(${value})
Subrules:
value:
MatchMode: Full
In: --use_fast_math
Out: -ffast-math
Loading