aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrzej Janik <[email protected]>2024-12-05 15:18:45 +0100
committerAndrzej Janik <[email protected]>2024-12-05 15:18:45 +0100
commit69f76bc5770ffc33af5cdda9c879e46f20f09364 (patch)
treeda4c446399bf602bd9975ef5a6eeb6404cf85727
parent9ca1c2da5a1fcbcaab059ee190b74d90e6575007 (diff)
downloadZLUDA-69f76bc5770ffc33af5cdda9c879e46f20f09364.tar.gz
ZLUDA-69f76bc5770ffc33af5cdda9c879e46f20f09364.zip
Add common compiler options
-rw-r--r--comgr/src/lib.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/comgr/src/lib.rs b/comgr/src/lib.rs
index 94ba6ef..a07236e 100644
--- a/comgr/src/lib.rs
+++ b/comgr/src/lib.rs
@@ -137,7 +137,8 @@ pub fn compile_bitcode(
link_with_device_libs_info.set_isa_name(gcn_arch)?;
link_with_device_libs_info.set_language(amd_comgr_language_t::AMD_COMGR_LANGUAGE_LLVM_IR)?;
// This makes no sense, but it makes ockl linking work
- link_with_device_libs_info.set_options([c"-Xclang", c"-mno-link-builtin-bitcode-postopt"].into_iter())?;
+ link_with_device_libs_info
+ .set_options([c"-Xclang", c"-mno-link-builtin-bitcode-postopt"].into_iter())?;
let with_device_libs = do_action(
&linked_data_set,
&link_with_device_libs_info,
@@ -145,7 +146,20 @@ pub fn compile_bitcode(
)?;
let compile_action_info = ActionInfo::new()?;
compile_action_info.set_isa_name(gcn_arch)?;
- compile_action_info.set_options(iter::once(c"-O3"))?;
+ let common_options = [c"-O3", c"-mno-wavefrontsize64", c"-mcumode"].into_iter();
+ let opt_options = if cfg!(debug_assertions) {
+ [c"-g", c"", c"", c"", c""]
+ } else {
+ [
+ c"-g0",
+ // default inlining threshold times 10
+ c"-mllvm",
+ c"-inline-threshold=2250",
+ c"-mllvm",
+ c"-inlinehint-threshold=3250",
+ ]
+ };
+ compile_action_info.set_options(common_options.chain(opt_options))?;
let reloc_data_set = do_action(
&with_device_libs,
&compile_action_info,