Skip to content

Commit d144218

Browse files
committed
gate offload behind -Zunstable-options
1 parent 40055d6 commit d144218

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ pub(crate) fn run_pass_manager(
672672
write::llvm_optimize(cgcx, dcx, module, None, config, opt_level, opt_stage, stage)?;
673673
}
674674

675-
if cfg!(llvm_enzyme) && enable_gpu && !thin {
675+
if enable_gpu && !thin {
676676
let cx =
677677
SimpleCx::new(module.module_llvm.llmod(), &module.module_llvm.llcx, cgcx.pointer_size);
678678
crate::builder::gpu_offload::handle_gpu_code(cgcx, &cx);

compiler/rustc_interface/src/tests.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ use rustc_session::config::{
1313
CoverageOptions, DebugInfo, DumpMonoStatsFormat, ErrorOutputType, ExternEntry, ExternLocation,
1414
Externs, FmtDebug, FunctionReturn, InliningThreshold, Input, InstrumentCoverage,
1515
InstrumentXRay, LinkSelfContained, LinkerPluginLto, LocationDetail, LtoCli, MirIncludeSpans,
16-
NextSolverConfig, OomStrategy, Options, OutFileName, OutputType, OutputTypes, PAuthKey, PacRet,
17-
Passes, PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip, SwitchWithOptPath,
18-
SymbolManglingVersion, WasiExecModel, build_configuration, build_session_options,
19-
rustc_optgroups,
16+
NextSolverConfig, Offload, OomStrategy, Options, OutFileName, OutputType, OutputTypes,
17+
PAuthKey, PacRet, Passes, PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip,
18+
SwitchWithOptPath, SymbolManglingVersion, WasiExecModel, build_configuration,
19+
build_session_options, rustc_optgroups,
2020
};
2121
use rustc_session::lint::Level;
2222
use rustc_session::search_paths::SearchPath;
@@ -833,6 +833,7 @@ fn test_unstable_options_tracking_hash() {
833833
tracked!(no_profiler_runtime, true);
834834
tracked!(no_trait_vptr, true);
835835
tracked!(no_unique_section_names, true);
836+
tracked!(offload, vec![Offload::Enable]);
836837
tracked!(on_broken_pipe, OnBrokenPipe::Kill);
837838
tracked!(oom, OomStrategy::Panic);
838839
tracked!(osx_rpath_install_name, true);

compiler/rustc_session/src/config.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,6 +2654,15 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
26542654
)
26552655
}
26562656

2657+
if !nightly_options::is_unstable_enabled(matches)
2658+
&& unstable_opts.offload.contains(&Offload::Enable)
2659+
{
2660+
early_dcx.early_fatal(
2661+
"`-Zoffload=Enable` also requires `-Zunstable-options` \
2662+
and a nightly compiler",
2663+
)
2664+
}
2665+
26572666
// For testing purposes, until we have more feedback about these options: ensure `-Z
26582667
// unstable-options` is required when using the unstable `-C link-self-contained` and `-C
26592668
// linker-flavor` options.

tests/codegen/gpu_offload/gpu_host.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -Zoffload=Enable -C opt-level=3 -Clto=fat
1+
//@ compile-flags: -Zoffload=Enable -Zunstable-options -C opt-level=3 -Clto=fat
22
//@ no-prefer-dynamic
33
//@ needs-enzyme
44

0 commit comments

Comments
 (0)