-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hack: Manually patch hipSYCL to enable ccache
Until AdaptiveCpp/AdaptiveCpp#1276 is merged
- Loading branch information
Showing
5 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
diff --git a/bin/acpp b/bin/acpp | ||
index 7d7db4cc..2dd39fc3 100755 | ||
--- a/bin/acpp | ||
+++ b/bin/acpp | ||
@@ -1987,7 +1987,7 @@ if __name__ == '__main__': | ||
if not config.has_optimization_flag(): | ||
print("acpp warning: No optimization flag was given, optimizations are " | ||
"disabled by default. Performance may be degraded. Compile with e.g. -O2/-O3 to " | ||
- "enable optimizations.") | ||
+ "enable optimizations.", file=sys.stderr) | ||
|
||
c = compiler(config) | ||
sys.exit(c.run()) | ||
diff --git a/cmake/syclcc-launcher b/cmake/syclcc-launcher | ||
index 41a626f8..37e884ff 100755 | ||
--- a/cmake/syclcc-launcher | ||
+++ b/cmake/syclcc-launcher | ||
@@ -63,14 +63,22 @@ if __name__ == '__main__': | ||
'command [command-args...]'.format(sys.argv[0], CXX_COMPILER_ARG, SYCLCC_ARG), file=sys.stderr) | ||
sys.exit(1) | ||
|
||
- command_in = sys.argv[command_offset] | ||
- command_in_args = sys.argv[command_offset + 1:] | ||
+ # If this is a compilation step, attempt to find the expected compiler (e.g. clang++). | ||
+ # This may not be the first argument, in case additional CMAKE_CXX_COMPILER_LAUNCHERs are set. | ||
+ compiler_offset = command_offset | ||
+ while compiler_offset < len(sys.argv) and ( | ||
+ not os.path.isfile(sys.argv[compiler_offset]) or | ||
+ not os.path.samefile(cxx_compiler_exe, sys.argv[compiler_offset])): | ||
+ compiler_offset += 1 | ||
+ is_compilation_step = compiler_offset < len(sys.argv) | ||
|
||
- # When invoked with a command line for expected compiler (e.g. clang++), replace with a syclcc invocation. | ||
+ # When invoked with a command line for expected compiler, replace with a syclcc invocation. | ||
+ if is_compilation_step: | ||
+ launcher_commands = sys.argv[command_offset:compiler_offset] | ||
+ compiler_args = sys.argv[compiler_offset + 1:] | ||
+ command_line = [*launcher_commands, *syclcc_exe, *syclcc_specific_args, *compiler_args] | ||
# Otherwise, e.g. for invocations of `ar` for linking static libraries, just continue with the command as-is. | ||
- if os.path.samefile(cxx_compiler_exe, command_in): | ||
- command_line = [*syclcc_exe, *syclcc_specific_args, *command_in_args] | ||
else: | ||
- command_line = [command_in, *command_in_args] | ||
+ command_line = sys.argv[command_offset:] | ||
|
||
sys.exit(subprocess.run(command_line).returncode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
diff --git a/bin/syclcc-clang b/bin/syclcc-clang | ||
index 862c7a70..00c623b3 100755 | ||
--- a/bin/syclcc-clang | ||
+++ b/bin/syclcc-clang | ||
@@ -1931,7 +1931,7 @@ if __name__ == '__main__': | ||
if not config.has_optimization_flag(): | ||
print("syclcc warning: No optimization flag was given, optimizations are " | ||
"disabled by default. Performance may be degraded. Compile with e.g. -O2/-O3 to " | ||
- "enable optimizations.") | ||
+ "enable optimizations.", file=sys.stderr) | ||
|
||
c = compiler(config) | ||
sys.exit(c.run()) | ||
diff --git a/cmake/syclcc-launcher b/cmake/syclcc-launcher | ||
index 41a626f8..37e884ff 100755 | ||
--- a/cmake/syclcc-launcher | ||
+++ b/cmake/syclcc-launcher | ||
@@ -63,14 +63,22 @@ if __name__ == '__main__': | ||
'command [command-args...]'.format(sys.argv[0], CXX_COMPILER_ARG, SYCLCC_ARG), file=sys.stderr) | ||
sys.exit(1) | ||
|
||
- command_in = sys.argv[command_offset] | ||
- command_in_args = sys.argv[command_offset + 1:] | ||
+ # If this is a compilation step, attempt to find the expected compiler (e.g. clang++). | ||
+ # This may not be the first argument, in case additional CMAKE_CXX_COMPILER_LAUNCHERs are set. | ||
+ compiler_offset = command_offset | ||
+ while compiler_offset < len(sys.argv) and ( | ||
+ not os.path.isfile(sys.argv[compiler_offset]) or | ||
+ not os.path.samefile(cxx_compiler_exe, sys.argv[compiler_offset])): | ||
+ compiler_offset += 1 | ||
+ is_compilation_step = compiler_offset < len(sys.argv) | ||
|
||
- # When invoked with a command line for expected compiler (e.g. clang++), replace with a syclcc invocation. | ||
+ # When invoked with a command line for expected compiler, replace with a syclcc invocation. | ||
+ if is_compilation_step: | ||
+ launcher_commands = sys.argv[command_offset:compiler_offset] | ||
+ compiler_args = sys.argv[compiler_offset + 1:] | ||
+ command_line = [*launcher_commands, *syclcc_exe, *syclcc_specific_args, *compiler_args] | ||
# Otherwise, e.g. for invocations of `ar` for linking static libraries, just continue with the command as-is. | ||
- if os.path.samefile(cxx_compiler_exe, command_in): | ||
- command_line = [*syclcc_exe, *syclcc_specific_args, *command_in_args] | ||
else: | ||
- command_line = [command_in, *command_in_args] | ||
+ command_line = sys.argv[command_offset:] | ||
|
||
sys.exit(subprocess.run(command_line).returncode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
set -o errexit -o pipefail -o noclobber -o nounset | ||
|
||
cd /src | ||
# We have to try two different patches depending on which hipSYCL version is checked out, as `syclcc-clang` has recently been renamed to `acpp` | ||
git apply /root/patches/1276_stable.patch || git apply /root/patches/1276_HEAD.patch |