From 69f76bc5770ffc33af5cdda9c879e46f20f09364 Mon Sep 17 00:00:00 2001 From: Andrzej Janik Date: Thu, 5 Dec 2024 15:18:45 +0100 Subject: [PATCH] Add common compiler options --- comgr/src/lib.rs | 18 ++++++++++++++++-- 1 file 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,