rust icon indicating copy to clipboard operation
rust copied to clipboard

gpu offload host code generation

Open ZuseZ4 opened this issue 5 months ago • 12 comments

r? ghost

This will generate most of the host side code to use llvm's offload feature. The first PR will only handle automatic mem-transfers to and from the device. So if a user calls a kernel, we will copy inputs back and forth, but we won't do the actual kernel launch. Before merging, we will use LLVM's Info infrastructure to verify that the memcopies match what openmp offloa generates in C++. LIBOMPTARGET_INFO=-1 ./my_rust_binary should print that a memcpy to and later from the device is happening.

A follow-up PR will generate the actual device-side kernel which will then do computations on the GPU. A third PR will implement manual host2device and device2host functionality, but the goal is to minimize cases where a user has to overwrite our default handling due to performance issues.

I'm trying to get a full MVP out first, so this just recognizes GPU functions based on magic names. The final frontend will obviously move this over to use proper macros, like I'm already doing it for the autodiff work. This work will also be compatible with std::autodiff, so one can differentiate GPU kernels.

Tracking:

  • https://github.com/rust-lang/rust/issues/131513

ZuseZ4 avatar Jun 05 '25 20:06 ZuseZ4

The job mingw-check-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_mir_transform v0.0.0 (/checkout/compiler/rustc_mir_transform)
error: unused variable: `global`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:691:17
    |
691 |             let global = cx.declare_global("my_struct_global", offload_entry_ty);
    |                 ^^^^^^ help: if this is intentional, prefix it with an underscore: `_global`
    |
    = note: `-D unused-variables` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_variables)]`

error: unused variable: `global`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:692:17
    |
692 |             let global = cx.declare_global("my_struct_global2", kernel_arguments_ty);
    |                 ^^^^^^ help: if this is intentional, prefix it with an underscore: `_global`

error: unused variable: `size_name`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:713:21
    |
713 |                 let size_name = format!(".offload_sizes.{num}");
    |                     ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_size_name`

error: unused variable: `size_ty`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:714:21
    |
714 |                 let size_ty = cx.type_array(ti64, 4);
    |                     ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_size_ty`

[RUSTC-TIMING] rustc_codegen_llvm test:false 3.374
error: could not compile `rustc_codegen_llvm` (lib) due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] rustc_hir_analysis test:false 5.178

rust-log-analyzer avatar Jun 05 '25 20:06 rust-log-analyzer

The job mingw-check-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_mir_transform v0.0.0 (/checkout/compiler/rustc_mir_transform)
error: unused variable: `ti16`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:683:17
    |
683 |             let ti16 = cx.type_i16();
    |                 ^^^^ help: if this is intentional, prefix it with an underscore: `_ti16`
    |
    = note: `-D unused-variables` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_variables)]`

error: unused variable: `global`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:692:17
    |
692 |             let global = cx.declare_global("my_struct_global", offload_entry_ty);
    |                 ^^^^^^ help: if this is intentional, prefix it with an underscore: `_global`

error: unused variable: `global`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:693:17
    |
693 |             let global = cx.declare_global("my_struct_global2", kernel_arguments_ty);
    |                 ^^^^^^ help: if this is intentional, prefix it with an underscore: `_global`

error: unused variable: `maptypes`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:724:21
    |
724 |                 let maptypes = add_priv_unnamed_arr(&cx, &format!(".offload_maptypes.{num}"), &vec![800u64, 544, 547, 544]);
    |                     ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_maptypes`

error: unused variable: `size_ty`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:706:25
    |
706 |                     let size_ty = cx.type_array(ti64, vals.len() as u64);
    |                         ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_size_ty`

[RUSTC-TIMING] rustc_codegen_llvm test:false 3.424
error: could not compile `rustc_codegen_llvm` (lib) due to 5 previous errors
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] rustc_hir_analysis test:false 5.966

rust-log-analyzer avatar Jun 05 '25 23:06 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
info: removing rustup binaries
info: rustup is uninstalled
##[group]Image checksum input
mingw-check-tidy
# We use the ghcr base image because ghcr doesn't have a rate limit
# and the mingw-check-tidy job doesn't cache docker images in CI.
FROM ghcr.io/rust-lang/ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
  g++ \
---

COPY host-x86_64/mingw-check-1/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check-1/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 npm install eslint@$(head -n 1 /tmp/eslint.version) && \
 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#15 2.782 Building wheels for collected packages: reuse
#15 2.783   Building wheel for reuse (pyproject.toml): started
#15 2.994   Building wheel for reuse (pyproject.toml): finished with status 'done'
#15 2.995   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132719 sha256=d2a2565e7037ad3883fb9337653f2e25bbb588534fbef3697286cbc26d1bf634
#15 2.995   Stored in directory: /tmp/pip-ephem-wheel-cache-vecm80fa/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#15 2.997 Successfully built reuse
#15 2.998 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#15 3.392 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#15 3.392 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#15 3.922 Collecting virtualenv
#15 3.979   Downloading virtualenv-20.31.2-py3-none-any.whl (6.1 MB)
#15 4.170      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.1/6.1 MB 32.0 MB/s eta 0:00:00
#15 4.214 Collecting distlib<1,>=0.3.7
#15 4.222   Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#15 4.232      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 55.6 MB/s eta 0:00:00
#15 4.271 Collecting filelock<4,>=3.12.2
#15 4.278   Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
#15 4.315 Collecting platformdirs<5,>=3.9.1
#15 4.323   Downloading platformdirs-4.3.8-py3-none-any.whl (18 kB)
#15 4.402 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#15 4.589 Successfully installed distlib-0.3.9 filelock-3.18.0 platformdirs-4.3.8 virtualenv-20.31.2
#15 4.589 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#15 DONE 4.7s

#16 [10/11] COPY host-x86_64/mingw-check-1/validate-toolstate.sh /scripts/
#16 DONE 0.0s
---
DirectMap4k:      139200 kB
DirectMap2M:     9297920 kB
DirectMap1G:     9437184 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 npm install eslint@$(head -n 1 /tmp/eslint.version) &&  python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
+ head -n 1 /tmp/eslint.version
+ TIDY_PRINT_DIFF=1 npm install [email protected]
npm WARN deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated @humanwhocodes/[email protected]: Use @eslint/config-array instead
npm WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm WARN deprecated @humanwhocodes/[email protected]: Use @eslint/object-schema instead
npm WARN deprecated [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.

added 89 packages in 3s

17 packages are looking for funding
  run `npm fund` for details
+ python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.05s
##[endgroup]
WARN: currently no CI rustc builds have rustc debug assertions enabled. Please either set `rust.debug-assertions` to `false` if you want to use download CI rustc or set `rust.download-rustc` to `false`.
downloading https://static.rust-lang.org/dist/2025-05-27/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
---
##[endgroup]
[TIMING] core::build_steps::tool::ToolBuild { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, tool: "tidy", path: "src/tools/tidy", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "", cargo_args: [], artifact_kind: Binary } -- 9.733
[TIMING] core::build_steps::tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:653:
     // We then run the llvm_optimize function a second time, to optimize the code which we generated
     // in the enzyme differentiation pass.
     let enable_ad = config.autodiff.contains(&config::AutoDiff::Enable);
-    let enable_gpu = true;//config.offload.contains(&config::Offload::Enable);
+    let enable_gpu = true; //config.offload.contains(&config::Offload::Enable);
     let stage = if thin {
         write::AutodiffStage::PreAD
     } else {
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:685:
             let tarr = cx.type_array(ti32, 3);
 
             let entry_elements = vec![ti64, ti16, ti16, ti32, tptr, tptr, ti64, ti64, tptr];
-            let kernel_elements = vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
+            let kernel_elements =
+                vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
 
             cx.set_struct_body(offload_entry_ty, &entry_elements, false);
             cx.set_struct_body(kernel_arguments_ty, &kernel_elements, false);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:710:
                     }
                     let initializer = cx.const_array(ti64, &size_val);
                     let c_name = CString::new(name).unwrap();
-                    let array = llvm::add_global(cx.llmod, cx.val_ty(initializer), &c_name );
+                    let array = llvm::add_global(cx.llmod, cx.val_ty(initializer), &c_name);
                     llvm::set_global_constant(array, true);
-                    unsafe {llvm::LLVMSetUnnamedAddress(array, llvm::UnnamedAddr::Global)};
+                    unsafe { llvm::LLVMSetUnnamedAddress(array, llvm::UnnamedAddr::Global) };
                     llvm::set_linkage(array, llvm::Linkage::PrivateLinkage);
                     llvm::set_initializer(array, initializer);
-
                 }
 
                 // We add a pair of sizes and maptypes per offloadable function.
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:722:
                 // @.offload_maptypes = private unnamed_addr constant [4 x i64] [i64 800, i64 544, i64 547, i64 544]
-                let array = add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![8u64,0,16,0]);
-                let maptypes = add_priv_unnamed_arr(&cx, &format!(".offload_maptypes.{num}"), &vec![800u64, 544, 547, 544]);
+                let array = add_priv_unnamed_arr(
+                    &cx,
+                    &format!(".offload_sizes.{num}"),
+                    &vec![8u64, 0, 16, 0],
+                );
+                let maptypes = add_priv_unnamed_arr(
+                    &cx,
+                    &format!(".offload_maptypes.{num}"),
+                    &vec![800u64, 544, 547, 544],
+                );
                 dbg!(&array);
                 // TODO: We should add another pair per call to offloadable functions
                 // @.offload_sizes.5 = private unnamed_addr constant [2 x i64] [i64 16384, i64 16384]
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:738:
                 llvm::set_linkage(entry, llvm::Linkage::WeakAnyLinkage);
                 llvm::set_initializer(entry, cx.get_const_i8(0));
 
-
                 let section_name = format!(".llvm.rodata.offloading");
                 let c_section_name = CString::new(section_name).unwrap();
 
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:746:
                 let c_entry_name = CString::new(entry_name).unwrap();
                 let c_val = c_entry_name.as_bytes_with_nul();
                 //let const_name = cx.const_bytes(c_val);
-                let len = u64::try_from(c_val.len()).expect("LLVMConstArray2 elements len overflow");
+                let len =
+                    u64::try_from(c_val.len()).expect("LLVMConstArray2 elements len overflow");
                 let foo = unsafe { llvm::LLVMConstArray2(ti8, c_val.as_ptr(), len) };
                 llvm::set_alignment(foo, rustc_abi::Align::ONE);
                 dbg!(&foo);
Diff in /checkout/compiler/rustc_codegen_llvm/src/declare.rs:135:
     pub(crate) fn define_private_global(&self, ty: &'ll Type) -> &'ll Value {
         unsafe { llvm::LLVMRustInsertPrivateGlobal(self.llmod(), ty) }
     }
-
 }
 
 impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
Diff in /checkout/compiler/rustc_session/src/config.rs:3068:
     };
 
     use super::{
-        AutoDiff, Offload, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
+        AutoDiff, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
         CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FmtDebug, FunctionReturn,
         InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
-        LtoCli, MirStripDebugInfo, NextSolverConfig, OomStrategy, OptLevel, OutFileName,
+        LtoCli, MirStripDebugInfo, NextSolverConfig, Offload, OomStrategy, OptLevel, OutFileName,
         OutputType, OutputTypes, PatchableFunctionEntry, Polonius, RemapPathScopeComponents,
         ResolveDocLinks, SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath,
         SymbolManglingVersion, WasiExecModel,
fmt: checked 6039 files
Build completed unsuccessfully in 0:00:44
  local time: Fri Jun  6 00:53:16 UTC 2025
  network time: Fri, 06 Jun 2025 00:53:16 GMT
##[error]Process completed with exit code 1.

rust-log-analyzer avatar Jun 06 '25 00:06 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
info: removing rustup binaries
info: rustup is uninstalled
##[group]Image checksum input
mingw-check-tidy
# We use the ghcr base image because ghcr doesn't have a rate limit
# and the mingw-check-tidy job doesn't cache docker images in CI.
FROM ghcr.io/rust-lang/ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
  g++ \
---

COPY host-x86_64/mingw-check-1/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check-1/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 npm install eslint@$(head -n 1 /tmp/eslint.version) && \
 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#15 2.918 Building wheels for collected packages: reuse
#15 2.919   Building wheel for reuse (pyproject.toml): started
#15 3.139   Building wheel for reuse (pyproject.toml): finished with status 'done'
#15 3.140   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132719 sha256=d2a2565e7037ad3883fb9337653f2e25bbb588534fbef3697286cbc26d1bf634
#15 3.141   Stored in directory: /tmp/pip-ephem-wheel-cache-859mugzc/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#15 3.143 Successfully built reuse
#15 3.144 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#15 3.559 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#15 3.559 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#15 4.109 Collecting virtualenv
#15 4.194   Downloading virtualenv-20.31.2-py3-none-any.whl (6.1 MB)
#15 4.345      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.1/6.1 MB 41.1 MB/s eta 0:00:00
#15 4.388 Collecting distlib<1,>=0.3.7
#15 4.408   Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#15 4.416      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 80.1 MB/s eta 0:00:00
#15 4.452 Collecting filelock<4,>=3.12.2
#15 4.472   Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
#15 4.508 Collecting platformdirs<5,>=3.9.1
#15 4.528   Downloading platformdirs-4.3.8-py3-none-any.whl (18 kB)
#15 4.612 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#15 4.805 Successfully installed distlib-0.3.9 filelock-3.18.0 platformdirs-4.3.8 virtualenv-20.31.2
#15 4.806 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#15 DONE 4.9s

#16 [10/11] COPY host-x86_64/mingw-check-1/validate-toolstate.sh /scripts/
#16 DONE 0.0s
---
DirectMap4k:      139200 kB
DirectMap2M:     9297920 kB
DirectMap1G:     9437184 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 npm install eslint@$(head -n 1 /tmp/eslint.version) &&  python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
+ head -n 1 /tmp/eslint.version
+ TIDY_PRINT_DIFF=1 npm install [email protected]
npm WARN deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated @humanwhocodes/[email protected]: Use @eslint/config-array instead
npm WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm WARN deprecated @humanwhocodes/[email protected]: Use @eslint/object-schema instead
npm WARN deprecated [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.

added 89 packages in 3s

17 packages are looking for funding
  run `npm fund` for details
+ python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.05s
##[endgroup]
WARN: currently no CI rustc builds have rustc debug assertions enabled. Please either set `rust.debug-assertions` to `false` if you want to use download CI rustc or set `rust.download-rustc` to `false`.
downloading https://static.rust-lang.org/dist/2025-05-27/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
---
Diff in /checkout/compiler/rustc_session/src/config.rs:3068:
     };
 
     use super::{
-        AutoDiff, Offload, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
+        AutoDiff, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
         CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FmtDebug, FunctionReturn,
         InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
-        LtoCli, MirStripDebugInfo, NextSolverConfig, OomStrategy, OptLevel, OutFileName,
+        LtoCli, MirStripDebugInfo, NextSolverConfig, Offload, OomStrategy, OptLevel, OutFileName,
         OutputType, OutputTypes, PatchableFunctionEntry, Polonius, RemapPathScopeComponents,
         ResolveDocLinks, SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath,
         SymbolManglingVersion, WasiExecModel,
Diff in /checkout/compiler/rustc_codegen_llvm/src/declare.rs:135:
     pub(crate) fn define_private_global(&self, ty: &'ll Type) -> &'ll Value {
         unsafe { llvm::LLVMRustInsertPrivateGlobal(self.llmod(), ty) }
     }
-
 }
 
 impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:653:
     // We then run the llvm_optimize function a second time, to optimize the code which we generated
     // in the enzyme differentiation pass.
     let enable_ad = config.autodiff.contains(&config::AutoDiff::Enable);
-    let enable_gpu = true;//config.offload.contains(&config::Offload::Enable);
+    let enable_gpu = true; //config.offload.contains(&config::Offload::Enable);
     let stage = if thin {
         write::AutodiffStage::PreAD
     } else {
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:685:
             let tarr = cx.type_array(ti32, 3);
 
             let entry_elements = vec![ti64, ti16, ti16, ti32, tptr, tptr, ti64, ti64, tptr];
-            let kernel_elements = vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
+            let kernel_elements =
+                vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
 
             cx.set_struct_body(offload_entry_ty, &entry_elements, false);
             cx.set_struct_body(kernel_arguments_ty, &kernel_elements, false);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:710:
                     }
                     let initializer = cx.const_array(ti64, &size_val);
                     let c_name = CString::new(name).unwrap();
-                    let array = llvm::add_global(cx.llmod, cx.val_ty(initializer), &c_name );
+                    let array = llvm::add_global(cx.llmod, cx.val_ty(initializer), &c_name);
                     llvm::set_global_constant(array, true);
-                    unsafe {llvm::LLVMSetUnnamedAddress(array, llvm::UnnamedAddr::Global)};
+                    unsafe { llvm::LLVMSetUnnamedAddress(array, llvm::UnnamedAddr::Global) };
                     llvm::set_linkage(array, llvm::Linkage::PrivateLinkage);
                     llvm::set_initializer(array, initializer);
-
                 }
 
                 // We add a pair of sizes and maptypes per offloadable function.
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:722:
                 // @.offload_maptypes = private unnamed_addr constant [4 x i64] [i64 800, i64 544, i64 547, i64 544]
-                let array = add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![8u64,0,16,0]);
-                let maptypes = add_priv_unnamed_arr(&cx, &format!(".offload_maptypes.{num}"), &vec![800u64, 544, 547, 544]);
+                let array = add_priv_unnamed_arr(
+                    &cx,
+                    &format!(".offload_sizes.{num}"),
+                    &vec![8u64, 0, 16, 0],
+                );
+                let maptypes = add_priv_unnamed_arr(
+                    &cx,
+                    &format!(".offload_maptypes.{num}"),
+                    &vec![800u64, 544, 547, 544],
+                );
                 dbg!(&array);
                 // TODO: We should add another pair per call to offloadable functions
                 // @.offload_sizes.5 = private unnamed_addr constant [2 x i64] [i64 16384, i64 16384]
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:738:
                 llvm::set_linkage(entry, llvm::Linkage::WeakAnyLinkage);
                 llvm::set_initializer(entry, cx.get_const_i8(0));
 
-
                 let section_name = format!(".llvm.rodata.offloading");
                 let c_section_name = CString::new(section_name).unwrap();
 
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:749:
                 let c_foo = CString::new(foo).unwrap();
 
                 let llconst = crate::common::bytes_in_context(cx.llcx, c_val);
-                let llglobal =
-                    llvm::add_global(cx.llmod, crate::common::val_ty(llconst), &c_foo);
+                let llglobal = llvm::add_global(cx.llmod, crate::common::val_ty(llconst), &c_foo);
                 llvm::set_alignment(llglobal, rustc_abi::Align::ONE);
                 llvm::set_section(llglobal, &c_section_name);
                 llvm::set_global_constant(llglobal, true);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:757:
                 llvm::set_linkage(llglobal, llvm::Linkage::InternalLinkage);
-                unsafe {llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global)};
+                unsafe { llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global) };
                 llvm::set_initializer(llglobal, llconst);
                 //dbg!(&foo);
                 // @.offloading.entry_name = internal unnamed_addr constant [66 x i8] c"__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7\00", section ".llvm.rodata.offloading", align 1
fmt: checked 6049 files
Build completed unsuccessfully in 0:00:43
  local time: Fri Jun  6 21:41:24 UTC 2025
  network time: Fri, 06 Jun 2025 21:41:24 GMT
##[error]Process completed with exit code 1.

rust-log-analyzer avatar Jun 06 '25 21:06 rust-log-analyzer

The job mingw-check-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_hir_typeck v0.0.0 (/checkout/compiler/rustc_hir_typeck)
error: unused variable: `ti8`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:686:17
    |
686 |             let ti8 = cx.type_i8();
    |                 ^^^ help: if this is intentional, prefix it with an underscore: `_ti8`
    |
    = note: `-D unused-variables` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_variables)]`

error: unused variable: `global`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:694:17
    |
694 |             let global = cx.declare_global("my_struct_global", offload_entry_ty);
    |                 ^^^^^^ help: if this is intentional, prefix it with an underscore: `_global`

error: unused variable: `global`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:695:17
    |
695 |             let global = cx.declare_global("my_struct_global2", kernel_arguments_ty);
    |                 ^^^^^^ help: if this is intentional, prefix it with an underscore: `_global`

error: unused variable: `o_sizes`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:729:21
    |
729 |                 let o_sizes = add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![8u64,0,16,0]);
    |                     ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_o_sizes`

error: unused variable: `o_types`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:730:21
    |
730 |                 let o_types = add_priv_unnamed_arr(&cx, &format!(".offload_maptypes.{num}"), &vec![800u64, 544, 547, 544]);
    |                     ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_o_types`

error: unused variable: `size_ty`
   --> compiler/rustc_codegen_llvm/src/back/lto.rs:708:25
    |
708 |                     let size_ty = cx.type_array(ti64, vals.len() as u64);
    |                         ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_size_ty`

[RUSTC-TIMING] rustc_codegen_llvm test:false 3.347
error: could not compile `rustc_codegen_llvm` (lib) due to 6 previous errors
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] rustc_mir_transform test:false 4.817

rust-log-analyzer avatar Jun 06 '25 23:06 rust-log-analyzer

The job aarch64-gnu-llvm-19-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Diff in /checkout/compiler/rustc_session/src/config.rs:3068:
     };
 
     use super::{
-        AutoDiff, Offload, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
+        AutoDiff, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
         CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FmtDebug, FunctionReturn,
         InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
-        LtoCli, MirStripDebugInfo, NextSolverConfig, OomStrategy, OptLevel, OutFileName,
+        LtoCli, MirStripDebugInfo, NextSolverConfig, Offload, OomStrategy, OptLevel, OutFileName,
         OutputType, OutputTypes, PatchableFunctionEntry, Polonius, RemapPathScopeComponents,
         ResolveDocLinks, SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath,
         SymbolManglingVersion, WasiExecModel,
Diff in /checkout/compiler/rustc_codegen_llvm/src/declare.rs:99:
             )
         }
     }
-
 }
 
 impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
Diff in /checkout/compiler/rustc_codegen_llvm/src/common.rs:377:
     }
 }
 
-pub(crate) fn named_struct<'ll>(
-    ty: &'ll Type,
-    elts: &[&'ll Value],
-) -> &'ll Value {
+pub(crate) fn named_struct<'ll>(ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
     let len = c_uint::try_from(elts.len()).expect("LLVMConstStructInContext elements len overflow");
     unsafe { llvm::LLVMConstNamedStruct(ty, elts.as_ptr(), len) }
 }
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:6:
 use std::sync::Arc;
 use std::{io, iter, slice};
 
+use llvm::Linkage::*;
 use object::read::archive::ArchiveFile;
 use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule, ThinShared};
 use rustc_codegen_ssa::back::symbol_export;
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:22:
 use rustc_session::config::{self, CrateType, Lto};
 use tracing::{debug, info};
 
-use llvm::Linkage::*;
-
 use crate::back::write::{
     self, CodegenDiagnosticsStage, DiagnosticHandlers, bitcode_section_name, save_temp_bitcode,
 };
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:31:
     DynamicLinkingWithLTO, LlvmError, LtoBitcodeFromRlib, LtoDisallowed, LtoDylib, LtoProcMacro,
 };
 use crate::llvm::AttributePlace::Function;
-use crate::llvm::{self, build_string, Linkage};
+use crate::llvm::{self, Linkage, build_string};
 use crate::{LlvmCodegenBackend, ModuleLlvm, SimpleCx, attributes};
 
 /// We keep track of the computed LTO cache keys from the previous
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:655:
     // We then run the llvm_optimize function a second time, to optimize the code which we generated
     // in the enzyme differentiation pass.
     let enable_ad = config.autodiff.contains(&config::AutoDiff::Enable);
-    let enable_gpu = true;//config.offload.contains(&config::Offload::Enable);
+    let enable_gpu = true; //config.offload.contains(&config::Offload::Enable);
     let stage = if thin {
         write::AutodiffStage::PreAD
     } else {
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:699:
             //   void *AuxAddr;
             // } __tgt_offload_entry;
             let entry_elements = vec![ti64, ti16, ti16, ti32, tptr, tptr, ti64, ti64, tptr];
-            let kernel_elements = vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
+            let kernel_elements =
+                vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
 
             cx.set_struct_body(offload_entry_ty, &entry_elements, false);
             cx.set_struct_body(kernel_arguments_ty, &kernel_elements, false);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:706:
             let global = cx.declare_global("my_struct_global", offload_entry_ty);
             let global = cx.declare_global("my_struct_global2", kernel_arguments_ty);
-//@my_struct_global = external global %struct.__tgt_offload_entry
-//@my_struct_global2 = external global %struct.__tgt_kernel_arguments
+            //@my_struct_global = external global %struct.__tgt_offload_entry
+            //@my_struct_global2 = external global %struct.__tgt_kernel_arguments
             dbg!(&offload_entry_ty);
             dbg!(&kernel_arguments_ty);
             //LLVMTypeRef elements[9] = {i64Ty, i16Ty, i16Ty, i32Ty, ptrTy, ptrTy, i64Ty, i64Ty, ptrTy};
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:717:
                     continue;
                 }
 
-                fn add_priv_unnamed_arr<'ll>(cx: &SimpleCx<'ll>, name: &str, vals: &[u64]) -> &'ll llvm::Value{
+                fn add_priv_unnamed_arr<'ll>(
+                    cx: &SimpleCx<'ll>,
+                    name: &str,
+                    vals: &[u64],
+                ) -> &'ll llvm::Value {
                     let ti64 = cx.type_i64();
                     let size_ty = cx.type_array(ti64, vals.len() as u64);
                     let mut size_val = Vec::with_capacity(vals.len());
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:728:
                     add_unnamed_global(cx, name, initializer, PrivateLinkage)
                 }
 
-                fn add_global<'ll>(cx: &SimpleCx<'ll>, name: &str, initializer: &'ll llvm::Value, l: Linkage) -> &'ll llvm::Value {
+                fn add_global<'ll>(
+                    cx: &SimpleCx<'ll>,
+                    name: &str,
+                    initializer: &'ll llvm::Value,
+                    l: Linkage,
+                ) -> &'ll llvm::Value {
                     let c_name = CString::new(name).unwrap();
-                    let llglobal: &'ll llvm::Value = llvm::add_global(cx.llmod, cx.val_ty(initializer), &c_name);
+                    let llglobal: &'ll llvm::Value =
+                        llvm::add_global(cx.llmod, cx.val_ty(initializer), &c_name);
                     llvm::set_global_constant(llglobal, true);
                     llvm::set_linkage(llglobal, l);
                     llvm::set_initializer(llglobal, initializer);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:737:
                     llglobal
                 }
 
-                fn add_unnamed_global<'ll>(cx: &SimpleCx<'ll>, name: &str, initializer: &'ll llvm::Value, l: Linkage) -> &'ll llvm::Value {
+                fn add_unnamed_global<'ll>(
+                    cx: &SimpleCx<'ll>,
+                    name: &str,
+                    initializer: &'ll llvm::Value,
+                    l: Linkage,
+                ) -> &'ll llvm::Value {
                     let llglobal = add_global(cx, name, initializer, l);
-                    unsafe {llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global)};
+                    unsafe { llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global) };
                     llglobal
                 }
 
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:746:
                 // We add a pair of sizes and maptypes per offloadable function.
                 // @.offload_maptypes = private unnamed_addr constant [4 x i64] [i64 800, i64 544, i64 547, i64 544]
-                let o_sizes = add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![8u64,0,16,0]);
-                let o_types = add_priv_unnamed_arr(&cx, &format!(".offload_maptypes.{num}"), &vec![800u64, 544, 547, 544]);
+                let o_sizes = add_priv_unnamed_arr(
+                    &cx,
+                    &format!(".offload_sizes.{num}"),
+                    &vec![8u64, 0, 16, 0],
+                );
+                let o_types = add_priv_unnamed_arr(
+                    &cx,
+                    &format!(".offload_maptypes.{num}"),
+                    &vec![800u64, 544, 547, 544],
+                );
                 // TODO: We should add another pair per call to offloadable functions
                 // @.offload_sizes.5 = private unnamed_addr constant [2 x i64] [i64 16384, i64 16384]
                 // @.offload_maptypes.6 = private unnamed_addr constant [2 x i64] [i64 1, i64 3]
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:770:
                 let c_section_name = CString::new(".llvm.rodata.offloading").unwrap();
                 llvm::set_section(llglobal, &c_section_name);
 
-
                 // New, TODO: cleanup
                 let name = format!(".offloading.entry.kernel_{num}");
                 let ci64_0 = cx.get_const_i64(0);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:777:
                 let ci16_1 = cx.get_const_i16(1);
-                let elems: Vec<&llvm::Value> = vec![ci64_0, ci16_1, ci16_1, cx.get_const_i32(0), region_id, llglobal, ci64_0, ci64_0, cx.const_null(cx.type_ptr())];
+                let elems: Vec<&llvm::Value> = vec![
+                    ci64_0,
+                    ci16_1,
+                    ci16_1,
+                    cx.get_const_i32(0),
+                    region_id,
+                    llglobal,
+                    ci64_0,
+                    ci64_0,
+                    cx.const_null(cx.type_ptr()),
+                ];
 
                 let initializer = crate::common::named_struct(offload_entry_ty, &elems);
                 let c_name = CString::new(name).unwrap();
fmt: checked 6049 files
Build completed unsuccessfully in 0:00:39
  local time: Sun Jun  8 01:08:48 UTC 2025
  network time: Sun, 08 Jun 2025 01:08:48 GMT
##[error]Process completed with exit code 1.

rust-log-analyzer avatar Jun 08 '25 01:06 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
info: removing rustup binaries
info: rustup is uninstalled
##[group]Image checksum input
mingw-check-tidy
# We use the ghcr base image because ghcr doesn't have a rate limit
# and the mingw-check-tidy job doesn't cache docker images in CI.
FROM ghcr.io/rust-lang/ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
  g++ \
---

COPY host-x86_64/mingw-check-1/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check-1/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 npm install eslint@$(head -n 1 /tmp/eslint.version) && \
 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#15 3.990   Downloading virtualenv-20.31.2-py3-none-any.whl (6.1 MB)
#15 4.071      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.1/6.1 MB 77.3 MB/s eta 0:00:00
#15 4.133 Collecting filelock<4,>=3.12.2
#15 4.136   Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
#15 4.170 Collecting platformdirs<5,>=3.9.1
#15 4.174   Downloading platformdirs-4.3.8-py3-none-any.whl (18 kB)
#15 4.192 Collecting distlib<1,>=0.3.7
#15 4.196   Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#15 4.203      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 92.6 MB/s eta 0:00:00
#15 4.284 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#15 4.478 Successfully installed distlib-0.3.9 filelock-3.18.0 platformdirs-4.3.8 virtualenv-20.31.2
#15 4.478 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#15 DONE 4.6s

#16 [10/11] COPY host-x86_64/mingw-check-1/validate-toolstate.sh /scripts/
#16 DONE 0.0s
---
DirectMap4k:      147392 kB
DirectMap2M:     7192576 kB
DirectMap1G:    11534336 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 npm install eslint@$(head -n 1 /tmp/eslint.version) &&  python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
+ head -n 1 /tmp/eslint.version
+ TIDY_PRINT_DIFF=1 npm install [email protected]
npm WARN deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated @humanwhocodes/[email protected]: Use @eslint/config-array instead
npm WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm WARN deprecated @humanwhocodes/[email protected]: Use @eslint/object-schema instead
npm WARN deprecated [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.

added 89 packages in 3s

17 packages are looking for funding
  run `npm fund` for details
+ python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.05s
##[endgroup]
WARN: currently no CI rustc builds have rustc debug assertions enabled. Please either set `rust.debug-assertions` to `false` if you want to use download CI rustc or set `rust.download-rustc` to `false`.
downloading https://static.rust-lang.org/dist/2025-05-27/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
---
     }
-
 }
 
 impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
Diff in /checkout/compiler/rustc_codegen_llvm/src/common.rs:377:
     }
 }
 
-pub(crate) fn named_struct<'ll>(
-    ty: &'ll Type,
-    elts: &[&'ll Value],
-) -> &'ll Value {
+pub(crate) fn named_struct<'ll>(ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
     let len = c_uint::try_from(elts.len()).expect("LLVMConstStructInContext elements len overflow");
     unsafe { llvm::LLVMConstNamedStruct(ty, elts.as_ptr(), len) }
 }
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:6:
 use std::sync::Arc;
 use std::{io, iter, slice};
 
+use llvm::Linkage::*;
 use object::read::archive::ArchiveFile;
 use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule, ThinShared};
 use rustc_codegen_ssa::back::symbol_export;
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:22:
 use rustc_session::config::{self, CrateType, Lto};
 use tracing::{debug, info};
 
-use llvm::Linkage::*;
-
 use crate::back::write::{
     self, CodegenDiagnosticsStage, DiagnosticHandlers, bitcode_section_name, save_temp_bitcode,
 };
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:31:
     DynamicLinkingWithLTO, LlvmError, LtoBitcodeFromRlib, LtoDisallowed, LtoDylib, LtoProcMacro,
 };
 use crate::llvm::AttributePlace::Function;
-use crate::llvm::{self, build_string, Linkage};
+use crate::llvm::{self, Linkage, build_string};
 use crate::{LlvmCodegenBackend, ModuleLlvm, SimpleCx, attributes};
 
 /// We keep track of the computed LTO cache keys from the previous
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:655:
     // We then run the llvm_optimize function a second time, to optimize the code which we generated
     // in the enzyme differentiation pass.
     let enable_ad = config.autodiff.contains(&config::AutoDiff::Enable);
-    let enable_gpu = true;//config.offload.contains(&config::Offload::Enable);
+    let enable_gpu = true; //config.offload.contains(&config::Offload::Enable);
     let stage = if thin {
         write::AutodiffStage::PreAD
     } else {
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:699:
             //   void *AuxAddr;
             // } __tgt_offload_entry;
             let entry_elements = vec![ti64, ti16, ti16, ti32, tptr, tptr, ti64, ti64, tptr];
-            let kernel_elements = vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
+            let kernel_elements =
+                vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
 
             cx.set_struct_body(offload_entry_ty, &entry_elements, false);
             cx.set_struct_body(kernel_arguments_ty, &kernel_elements, false);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:727:
             let mapper_end = String::from("__tgt_target_data_end_mapper");
             let args = vec![tptr, ti64, ti32, tptr, tptr, tptr, tptr, tptr, tptr];
             let mapper_fn_ty = cx.type_func(&args, cx.type_void());
-            let foo = crate::declare::declare_simple_fn(&cx, &mapper_begin, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
-            let bar = crate::declare::declare_simple_fn(&cx, &mapper_update, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
-            let baz = crate::declare::declare_simple_fn(&cx, &mapper_end, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
+            let foo = crate::declare::declare_simple_fn(
+                &cx,
+                &mapper_begin,
+                llvm::CallConv::CCallConv,
+                llvm::UnnamedAddr::No,
+                llvm::Visibility::Default,
+                mapper_fn_ty,
+            );
+            let bar = crate::declare::declare_simple_fn(
+                &cx,
---
+                llvm::UnnamedAddr::No,
+                llvm::Visibility::Default,
+                mapper_fn_ty,
+            );
             let nounwind = llvm::AttributeKind::NoUnwind.create_attr(cx.llcx);
             attributes::apply_to_llfn(foo, Function, &[nounwind]);
             attributes::apply_to_llfn(bar, Function, &[nounwind]);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:741:
                     continue;
                 }
 
-                fn add_priv_unnamed_arr<'ll>(cx: &SimpleCx<'ll>, name: &str, vals: &[u64]) -> &'ll llvm::Value{
+                fn add_priv_unnamed_arr<'ll>(
+                    cx: &SimpleCx<'ll>,
+                    name: &str,
+                    vals: &[u64],
+                ) -> &'ll llvm::Value {
                     let ti64 = cx.type_i64();
                     let size_ty = cx.type_array(ti64, vals.len() as u64);
                     let mut size_val = Vec::with_capacity(vals.len());
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:752:
                     add_unnamed_global(cx, name, initializer, PrivateLinkage)
                 }
 
-                fn add_global<'ll>(cx: &SimpleCx<'ll>, name: &str, initializer: &'ll llvm::Value, l: Linkage) -> &'ll llvm::Value {
+                fn add_global<'ll>(
+                    cx: &SimpleCx<'ll>,
+                    name: &str,
+                    initializer: &'ll llvm::Value,
+                    l: Linkage,
+                ) -> &'ll llvm::Value {
                     let c_name = CString::new(name).unwrap();
-                    let llglobal: &'ll llvm::Value = llvm::add_global(cx.llmod, cx.val_ty(initializer), &c_name);
+                    let llglobal: &'ll llvm::Value =
+                        llvm::add_global(cx.llmod, cx.val_ty(initializer), &c_name);
                     llvm::set_global_constant(llglobal, true);
                     llvm::set_linkage(llglobal, l);
                     llvm::set_initializer(llglobal, initializer);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:761:
                     llglobal
                 }
 
-                fn add_unnamed_global<'ll>(cx: &SimpleCx<'ll>, name: &str, initializer: &'ll llvm::Value, l: Linkage) -> &'ll llvm::Value {
+                fn add_unnamed_global<'ll>(
+                    cx: &SimpleCx<'ll>,
+                    name: &str,
+                    initializer: &'ll llvm::Value,
+                    l: Linkage,
+                ) -> &'ll llvm::Value {
                     let llglobal = add_global(cx, name, initializer, l);
-                    unsafe {llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global)};
+                    unsafe { llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global) };
                     llglobal
                 }
 
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:770:
                 // We add a pair of sizes and maptypes per offloadable function.
                 // @.offload_maptypes = private unnamed_addr constant [4 x i64] [i64 800, i64 544, i64 547, i64 544]
-                let o_sizes = add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![8u64,0,16,0]);
-                let o_types = add_priv_unnamed_arr(&cx, &format!(".offload_maptypes.{num}"), &vec![800u64, 544, 547, 544]);
+                let o_sizes = add_priv_unnamed_arr(
+                    &cx,
+                    &format!(".offload_sizes.{num}"),
+                    &vec![8u64, 0, 16, 0],
+                );
+                let o_types = add_priv_unnamed_arr(
+                    &cx,
+                    &format!(".offload_maptypes.{num}"),
+                    &vec![800u64, 544, 547, 544],
+                );
                 // TODO: We should add another pair per call to offloadable functions
                 // @.offload_sizes.5 = private unnamed_addr constant [2 x i64] [i64 16384, i64 16384]
                 // @.offload_maptypes.6 = private unnamed_addr constant [2 x i64] [i64 1, i64 3]
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:794:
                 let c_section_name = CString::new(".llvm.rodata.offloading").unwrap();
                 llvm::set_section(llglobal, &c_section_name);
 
-
                 // Not actively used yet, for calling real kernels
                 let name = format!(".offloading.entry.kernel_{num}");
                 let ci64_0 = cx.get_const_i64(0);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:801:
                 let ci16_1 = cx.get_const_i16(1);
-                let elems: Vec<&llvm::Value> = vec![ci64_0, ci16_1, ci16_1, cx.get_const_i32(0), region_id, llglobal, ci64_0, ci64_0, cx.const_null(cx.type_ptr())];
+                let elems: Vec<&llvm::Value> = vec![
+                    ci64_0,
+                    ci16_1,
+                    ci16_1,
+                    cx.get_const_i32(0),
+                    region_id,
+                    llglobal,
+                    ci64_0,
+                    ci64_0,
+                    cx.const_null(cx.type_ptr()),
+                ];
 
                 let initializer = crate::common::named_struct(offload_entry_ty, &elems);
                 let c_name = CString::new(name).unwrap();
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:814:
                 // @.offloading.entry.kernel_3 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.kernel_3.region_id, ptr @.offloading.entry_name.3, i64 0, i64 0, ptr null }, section ".omp_offloading_entries", align 1
                 // clang
                 // @.offloading.entry.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }, section "omp_offloading_entries", align 1
-
 
                 //
                 // 1. @.offload_sizes.{num} = private unnamed_addr constant [4 x i64] [i64 8, i64 0, i64 16, i64 0]
Diff in /checkout/compiler/rustc_session/src/config.rs:3068:
     };
 
     use super::{
-        AutoDiff, Offload, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
+        AutoDiff, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
         CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FmtDebug, FunctionReturn,
         InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
-        LtoCli, MirStripDebugInfo, NextSolverConfig, OomStrategy, OptLevel, OutFileName,
+        LtoCli, MirStripDebugInfo, NextSolverConfig, Offload, OomStrategy, OptLevel, OutFileName,
         OutputType, OutputTypes, PatchableFunctionEntry, Polonius, RemapPathScopeComponents,
         ResolveDocLinks, SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath,
         SymbolManglingVersion, WasiExecModel,
fmt: checked 6049 files
Build completed unsuccessfully in 0:00:45
  local time: Mon Jun  9 01:54:33 UTC 2025
  network time: Mon, 09 Jun 2025 01:54:34 GMT
##[error]Process completed with exit code 1.

rust-log-analyzer avatar Jun 09 '25 01:06 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

COPY host-x86_64/mingw-check-1/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check-1/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 npm install eslint@$(head -n 1 /tmp/eslint.version) && \
 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
DirectMap4k:      141248 kB
DirectMap2M:     8247296 kB
DirectMap1G:    10485760 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 npm install eslint@$(head -n 1 /tmp/eslint.version) &&  python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
+ head -n 1 /tmp/eslint.version
+ TIDY_PRINT_DIFF=1 npm install [email protected]
npm WARN deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated @humanwhocodes/[email protected]: Use @eslint/config-array instead
npm WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm WARN deprecated @humanwhocodes/[email protected]: Use @eslint/object-schema instead
---
Diff in /checkout/compiler/rustc_session/src/config.rs:3068:
     };
 
     use super::{
-        AutoDiff, Offload, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
+        AutoDiff, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
         CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FmtDebug, FunctionReturn,
         InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
-        LtoCli, MirStripDebugInfo, NextSolverConfig, OomStrategy, OptLevel, OutFileName,
+        LtoCli, MirStripDebugInfo, NextSolverConfig, Offload, OomStrategy, OptLevel, OutFileName,
         OutputType, OutputTypes, PatchableFunctionEntry, Polonius, RemapPathScopeComponents,
         ResolveDocLinks, SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath,
         SymbolManglingVersion, WasiExecModel,
Diff in /checkout/compiler/rustc_codegen_llvm/src/declare.rs:99:
             )
         }
     }
-
 }
 
 impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
Diff in /checkout/compiler/rustc_codegen_llvm/src/common.rs:377:
     }
 }
 
-pub(crate) fn named_struct<'ll>(
-    ty: &'ll Type,
-    elts: &[&'ll Value],
-) -> &'ll Value {
+pub(crate) fn named_struct<'ll>(ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
     let len = c_uint::try_from(elts.len()).expect("LLVMConstStructInContext elements len overflow");
     unsafe { llvm::LLVMConstNamedStruct(ty, elts.as_ptr(), len) }
 }
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:6:
 use std::sync::Arc;
 use std::{io, iter, slice};
 
+use llvm::Linkage::*;
 use object::read::archive::ArchiveFile;
 use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule, ThinShared};
 use rustc_codegen_ssa::back::symbol_export;
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:22:
 use rustc_session::config::{self, CrateType, Lto};
 use tracing::{debug, info};
 
-use llvm::Linkage::*;
-
 use crate::back::write::{
     self, CodegenDiagnosticsStage, DiagnosticHandlers, bitcode_section_name, save_temp_bitcode,
 };
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:31:
     DynamicLinkingWithLTO, LlvmError, LtoBitcodeFromRlib, LtoDisallowed, LtoDylib, LtoProcMacro,
 };
 use crate::llvm::AttributePlace::Function;
-use crate::llvm::{self, build_string, Linkage};
+use crate::llvm::{self, Linkage, build_string};
 use crate::{LlvmCodegenBackend, ModuleLlvm, SimpleCx, attributes};
 
 /// We keep track of the computed LTO cache keys from the previous
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:631:
 }
 
 fn gen_globals<'ll>(cx: &'ll SimpleCx<'_>) -> &'ll llvm::Type {
-            let offload_entry_ty = cx.type_named_struct("struct.__tgt_offload_entry");
-            let kernel_arguments_ty = cx.type_named_struct("struct.__tgt_kernel_arguments");
-            let tptr = cx.type_ptr();
-            let ti64 = cx.type_i64();
-            let ti32 = cx.type_i32();
-            let ti16 = cx.type_i16();
-            let ti8 = cx.type_i8();
-            let tarr = cx.type_array(ti32, 3);
+    let offload_entry_ty = cx.type_named_struct("struct.__tgt_offload_entry");
+    let kernel_arguments_ty = cx.type_named_struct("struct.__tgt_kernel_arguments");
+    let tptr = cx.type_ptr();
+    let ti64 = cx.type_i64();
+    let ti32 = cx.type_i32();
+    let ti16 = cx.type_i16();
+    let ti8 = cx.type_i8();
+    let tarr = cx.type_array(ti32, 3);
 
     // @0 = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1
     let unknown_txt = ";unknown;unknown;0;0;;";
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:650:
 
     // @1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 22, ptr @0 }, align 8
     let struct_ident_ty = cx.type_named_struct("struct.ident_t");
-    let struct_elems: Vec<&llvm::Value> = vec![cx.get_const_i32(0), cx.get_const_i32(2), cx.get_const_i32(0), cx.get_const_i32(22), at_zero];
+    let struct_elems: Vec<&llvm::Value> = vec![
+        cx.get_const_i32(0),
+        cx.get_const_i32(2),
+        cx.get_const_i32(0),
+        cx.get_const_i32(22),
+        at_zero,
+    ];
     let struct_elems_ty: Vec<_> = struct_elems.iter().map(|&x| cx.val_ty(x)).collect();
     let initializer = crate::common::named_struct(struct_ident_ty, &struct_elems);
     cx.set_struct_body(struct_ident_ty, &struct_elems_ty, false);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:657:
     let at_one = add_unnamed_global(&cx, &"", initializer, PrivateLinkage);
     llvm::set_alignment(at_one, rustc_abi::Align::EIGHT);
 
-            // coppied from LLVM
-            // typedef struct {
-            //   uint64_t Reserved;
-            //   uint16_t Version;
-            //   uint16_t Kind;
-            //   uint32_t Flags;
-            //   void *Address;
-            //   char *SymbolName;
-            //   uint64_t Size;
-            //   uint64_t Data;
-            //   void *AuxAddr;
-            // } __tgt_offload_entry;
-            let entry_elements = vec![ti64, ti16, ti16, ti32, tptr, tptr, ti64, ti64, tptr];
-            let kernel_elements = vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
+    // coppied from LLVM
+    // typedef struct {
+    //   uint64_t Reserved;
+    //   uint16_t Version;
+    //   uint16_t Kind;
+    //   uint32_t Flags;
+    //   void *Address;
+    //   char *SymbolName;
+    //   uint64_t Size;
+    //   uint64_t Data;
+    //   void *AuxAddr;
+    // } __tgt_offload_entry;
+    let entry_elements = vec![ti64, ti16, ti16, ti32, tptr, tptr, ti64, ti64, tptr];
+    let kernel_elements =
+        vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
 
-            cx.set_struct_body(offload_entry_ty, &entry_elements, false);
-            cx.set_struct_body(kernel_arguments_ty, &kernel_elements, false);
-            let global = cx.declare_global("my_struct_global", offload_entry_ty);
-            let global = cx.declare_global("my_struct_global2", kernel_arguments_ty);
-            //@my_struct_global = external global %struct.__tgt_offload_entry
-            //@my_struct_global2 = external global %struct.__tgt_kernel_arguments
-            dbg!(&offload_entry_ty);
-            dbg!(&kernel_arguments_ty);
-            //LLVMTypeRef elements[9] = {i64Ty, i16Ty, i16Ty, i32Ty, ptrTy, ptrTy, i64Ty, i64Ty, ptrTy};
-            //LLVMStructSetBody(structTy, elements, 9, 0);
+    cx.set_struct_body(offload_entry_ty, &entry_elements, false);
+    cx.set_struct_body(kernel_arguments_ty, &kernel_elements, false);
+    let global = cx.declare_global("my_struct_global", offload_entry_ty);
+    let global = cx.declare_global("my_struct_global2", kernel_arguments_ty);
+    //@my_struct_global = external global %struct.__tgt_offload_entry
+    //@my_struct_global2 = external global %struct.__tgt_kernel_arguments
+    dbg!(&offload_entry_ty);
+    dbg!(&kernel_arguments_ty);
+    //LLVMTypeRef elements[9] = {i64Ty, i16Ty, i16Ty, i32Ty, ptrTy, ptrTy, i64Ty, i64Ty, ptrTy};
+    //LLVMStructSetBody(structTy, elements, 9, 0);
 
-            // New, to test memtransfer
-            // ; Function Attrs: nounwind
-            // declare void @__tgt_target_data_begin_mapper(ptr, i64, i32, ptr, ptr, ptr, ptr, ptr, ptr) #3
-            //
-            // ; Function Attrs: nounwind
-            // declare void @__tgt_target_data_update_mapper(ptr, i64, i32, ptr, ptr, ptr, ptr, ptr, ptr) #3
-            //
-            // ; Function Attrs: nounwind
-            // declare void @__tgt_target_data_end_mapper(ptr, i64, i32, ptr, ptr, ptr, ptr, ptr, ptr) #3
+    // New, to test memtransfer
+    // ; Function Attrs: nounwind
+    // declare void @__tgt_target_data_begin_mapper(ptr, i64, i32, ptr, ptr, ptr, ptr, ptr, ptr) #3
+    //
+    // ; Function Attrs: nounwind
+    // declare void @__tgt_target_data_update_mapper(ptr, i64, i32, ptr, ptr, ptr, ptr, ptr, ptr) #3
+    //
+    // ; Function Attrs: nounwind
+    // declare void @__tgt_target_data_end_mapper(ptr, i64, i32, ptr, ptr, ptr, ptr, ptr, ptr) #3
 
-            let mapper_begin = "__tgt_target_data_begin_mapper";
-            let mapper_update = String::from("__tgt_target_data_update_mapper");
-            let mapper_end = String::from("__tgt_target_data_end_mapper");
-            let args = vec![tptr, ti64, ti32, tptr, tptr, tptr, tptr, tptr, tptr];
-            let mapper_fn_ty = cx.type_func(&args, cx.type_void());
-            let foo = crate::declare::declare_simple_fn(&cx, &mapper_begin, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
-            let bar = crate::declare::declare_simple_fn(&cx, &mapper_update, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
-            let baz = crate::declare::declare_simple_fn(&cx, &mapper_end, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
-            let nounwind = llvm::AttributeKind::NoUnwind.create_attr(cx.llcx);
-            attributes::apply_to_llfn(foo, Function, &[nounwind]);
-            attributes::apply_to_llfn(bar, Function, &[nounwind]);
-            attributes::apply_to_llfn(baz, Function, &[nounwind]);
+    let mapper_begin = "__tgt_target_data_begin_mapper";
+    let mapper_update = String::from("__tgt_target_data_update_mapper");
+    let mapper_end = String::from("__tgt_target_data_end_mapper");
+    let args = vec![tptr, ti64, ti32, tptr, tptr, tptr, tptr, tptr, tptr];
+    let mapper_fn_ty = cx.type_func(&args, cx.type_void());
+    let foo = crate::declare::declare_simple_fn(
+        &cx,
+        &mapper_begin,
+        llvm::CallConv::CCallConv,
+        llvm::UnnamedAddr::No,
+        llvm::Visibility::Default,
+        mapper_fn_ty,
+    );
+    let bar = crate::declare::declare_simple_fn(
+        &cx,
---
+        llvm::UnnamedAddr::No,
+        llvm::Visibility::Default,
+        mapper_fn_ty,
+    );
+    let nounwind = llvm::AttributeKind::NoUnwind.create_attr(cx.llcx);
+    attributes::apply_to_llfn(foo, Function, &[nounwind]);
+    attributes::apply_to_llfn(bar, Function, &[nounwind]);
+    attributes::apply_to_llfn(baz, Function, &[nounwind]);
 
-            offload_entry_ty
+    offload_entry_ty
 }
 
-fn add_priv_unnamed_arr<'ll>(cx: &SimpleCx<'ll>, name: &str, vals: &[u64]) -> &'ll llvm::Value{
+fn add_priv_unnamed_arr<'ll>(cx: &SimpleCx<'ll>, name: &str, vals: &[u64]) -> &'ll llvm::Value {
     let ti64 = cx.type_i64();
     let size_ty = cx.type_array(ti64, vals.len() as u64);
     let mut size_val = Vec::with_capacity(vals.len());
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:720:
     add_unnamed_global(cx, name, initializer, PrivateLinkage)
 }
 
-fn add_unnamed_global<'ll>(cx: &SimpleCx<'ll>, name: &str, initializer: &'ll llvm::Value, l: Linkage) -> &'ll llvm::Value {
+fn add_unnamed_global<'ll>(
+    cx: &SimpleCx<'ll>,
+    name: &str,
+    initializer: &'ll llvm::Value,
+    l: Linkage,
+) -> &'ll llvm::Value {
     let llglobal = add_global(cx, name, initializer, l);
-    unsafe {llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global)};
+    unsafe { llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global) };
     llglobal
 }
 
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:729:
-fn add_global<'ll>(cx: &SimpleCx<'ll>, name: &str, initializer: &'ll llvm::Value, l: Linkage) -> &'ll llvm::Value {
+fn add_global<'ll>(
+    cx: &SimpleCx<'ll>,
+    name: &str,
+    initializer: &'ll llvm::Value,
+    l: Linkage,
+) -> &'ll llvm::Value {
     let c_name = CString::new(name).unwrap();
     let llglobal: &'ll llvm::Value = llvm::add_global(cx.llmod, cx.val_ty(initializer), &c_name);
     llvm::set_global_constant(llglobal, true);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:735:
     llglobal
 }
 
-
-
 fn gen_define_handling<'ll>(cx: &'ll SimpleCx<'_>, offload_entry_ty: &'ll llvm::Type, num: i64) {
-                // We add a pair of sizes and maptypes per offloadable function.
-                // @.offload_maptypes = private unnamed_addr constant [4 x i64] [i64 800, i64 544, i64 547, i64 544]
-                let o_sizes = add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![8u64,0,16,0]);
-                let o_types = add_priv_unnamed_arr(&cx, &format!(".offload_maptypes.{num}"), &vec![800u64, 544, 547, 544]);
-                // TODO: We should add another pair per call to offloadable functions
-                // @.offload_sizes.5 = private unnamed_addr constant [2 x i64] [i64 16384, i64 16384]
-                // @.offload_maptypes.6 = private unnamed_addr constant [2 x i64] [i64 1, i64 3]
+    // We add a pair of sizes and maptypes per offloadable function.
+    // @.offload_maptypes = private unnamed_addr constant [4 x i64] [i64 800, i64 544, i64 547, i64 544]
+    let o_sizes =
+        add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![8u64, 0, 16, 0]);
+    let o_types = add_priv_unnamed_arr(
+        &cx,
+        &format!(".offload_maptypes.{num}"),
+        &vec![800u64, 544, 547, 544],
+    );
+    // TODO: We should add another pair per call to offloadable functions
+    // @.offload_sizes.5 = private unnamed_addr constant [2 x i64] [i64 16384, i64 16384]
+    // @.offload_maptypes.6 = private unnamed_addr constant [2 x i64] [i64 1, i64 3]
 
-                // Next: For each function, generate these three entries. A weak constant,
-                // the llvm.rodata entry name, and  the omp_offloading_entries value
+    // Next: For each function, generate these three entries. A weak constant,
+    // the llvm.rodata entry name, and  the omp_offloading_entries value
 
-                // @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id = weak constant i8 0
-                // @.offloading.entry_name = internal unnamed_addr constant [66 x i8] c"__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7\00", section ".llvm.rodata.offloading", align 1
-                let name = format!(".kernel_{num}.region_id");
-                let initializer = cx.get_const_i8(0);
-                let region_id = add_unnamed_global(&cx, &name, initializer, WeakAnyLinkage);
+    // @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id = weak constant i8 0
+    // @.offloading.entry_name = internal unnamed_addr constant [66 x i8] c"__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7\00", section ".llvm.rodata.offloading", align 1
+    let name = format!(".kernel_{num}.region_id");
+    let initializer = cx.get_const_i8(0);
+    let region_id = add_unnamed_global(&cx, &name, initializer, WeakAnyLinkage);
 
-                let c_entry_name = CString::new(format!("kernel_{num}")).unwrap();
-                let c_val = c_entry_name.as_bytes_with_nul();
-                let foo = format!(".offloading.entry_name.{num}");
+    let c_entry_name = CString::new(format!("kernel_{num}")).unwrap();
+    let c_val = c_entry_name.as_bytes_with_nul();
+    let foo = format!(".offloading.entry_name.{num}");
 
-                let initializer = crate::common::bytes_in_context(cx.llcx, c_val);
-                let llglobal = add_unnamed_global(&cx, &foo, initializer, InternalLinkage);
-                llvm::set_alignment(llglobal, rustc_abi::Align::ONE);
-                let c_section_name = CString::new(".llvm.rodata.offloading").unwrap();
-                llvm::set_section(llglobal, &c_section_name);
+    let initializer = crate::common::bytes_in_context(cx.llcx, c_val);
+    let llglobal = add_unnamed_global(&cx, &foo, initializer, InternalLinkage);
+    llvm::set_alignment(llglobal, rustc_abi::Align::ONE);
+    let c_section_name = CString::new(".llvm.rodata.offloading").unwrap();
+    llvm::set_section(llglobal, &c_section_name);
 
+    // Not actively used yet, for calling real kernels
+    let name = format!(".offloading.entry.kernel_{num}");
+    let ci64_0 = cx.get_const_i64(0);
+    let ci16_1 = cx.get_const_i16(1);
+    let elems: Vec<&llvm::Value> = vec![
+        ci64_0,
+        ci16_1,
+        ci16_1,
+        cx.get_const_i32(0),
+        region_id,
+        llglobal,
+        ci64_0,
+        ci64_0,
+        cx.const_null(cx.type_ptr()),
+    ];
 
-                // Not actively used yet, for calling real kernels
-                let name = format!(".offloading.entry.kernel_{num}");
-                let ci64_0 = cx.get_const_i64(0);
-                let ci16_1 = cx.get_const_i16(1);
-                let elems: Vec<&llvm::Value> = vec![ci64_0, ci16_1, ci16_1, cx.get_const_i32(0), region_id, llglobal, ci64_0, ci64_0, cx.const_null(cx.type_ptr())];
+    let initializer = crate::common::named_struct(offload_entry_ty, &elems);
+    let c_name = CString::new(name).unwrap();
+    let llglobal = llvm::add_global(cx.llmod, offload_entry_ty, &c_name);
+    llvm::set_global_constant(llglobal, true);
+    llvm::set_linkage(llglobal, WeakAnyLinkage);
+    llvm::set_initializer(llglobal, initializer);
+    llvm::set_alignment(llglobal, rustc_abi::Align::ONE);
+    let c_section_name = CString::new(".omp_offloading_entries").unwrap();
+    llvm::set_section(llglobal, &c_section_name);
+    // rustc
+    // @.offloading.entry.kernel_3 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.kernel_3.region_id, ptr @.offloading.entry_name.3, i64 0, i64 0, ptr null }, section ".omp_offloading_entries", align 1
+    // clang
+    // @.offloading.entry.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }, section "omp_offloading_entries", align 1
 
-                let initializer = crate::common::named_struct(offload_entry_ty, &elems);
-                let c_name = CString::new(name).unwrap();
-                let llglobal = llvm::add_global(cx.llmod, offload_entry_ty, &c_name);
-                llvm::set_global_constant(llglobal, true);
-                llvm::set_linkage(llglobal, WeakAnyLinkage);
-                llvm::set_initializer(llglobal, initializer);
-                llvm::set_alignment(llglobal, rustc_abi::Align::ONE);
-                let c_section_name = CString::new(".omp_offloading_entries").unwrap();
-                llvm::set_section(llglobal, &c_section_name);
-                // rustc
-                // @.offloading.entry.kernel_3 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.kernel_3.region_id, ptr @.offloading.entry_name.3, i64 0, i64 0, ptr null }, section ".omp_offloading_entries", align 1
-                // clang
-                // @.offloading.entry.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }, section "omp_offloading_entries", align 1
-
-
-                //
-                // 1. @.offload_sizes.{num} = private unnamed_addr constant [4 x i64] [i64 8, i64 0, i64 16, i64 0]
-                // 2. @.offload_maptypes
-                // 3. @.__omp_offloading_<hash>_fnc_name_<hash> = weak constant i8 0
-                // 4. @.offloading.entry_name = internal unnamed_addr constant [66 x i8] c"__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7\00", section ".llvm.rodata.offloading", align 1
-                // 5. @.offloading.entry.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }, section "omp_offloading_entries", align 1
+    //
+    // 1. @.offload_sizes.{num} = private unnamed_addr constant [4 x i64] [i64 8, i64 0, i64 16, i64 0]
+    // 2. @.offload_maptypes
+    // 3. @.__omp_offloading_<hash>_fnc_name_<hash> = weak constant i8 0
+    // 4. @.offloading.entry_name = internal unnamed_addr constant [66 x i8] c"__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7\00", section ".llvm.rodata.offloading", align 1
+    // 5. @.offloading.entry.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }, section "omp_offloading_entries", align 1
 }
 
 fn gen_call_handling<'ll>(cx: &'ll SimpleCx<'_>) {
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:799:
-            // call void @__tgt_target_data_begin_mapper(ptr @1, i64 -1, i32 3, ptr %27, ptr %28, ptr %29, ptr @.offload_maptypes, ptr null, ptr null)
-            // call void @__tgt_target_data_update_mapper(ptr @1, i64 -1, i32 2, ptr %46, ptr %47, ptr %48, ptr @.offload_maptypes.1, ptr null, ptr null)
-            // call void @__tgt_target_data_end_mapper(ptr @1, i64 -1, i32 3, ptr %49, ptr %50, ptr %51, ptr @.offload_maptypes, ptr null, ptr null)
+    // call void @__tgt_target_data_begin_mapper(ptr @1, i64 -1, i32 3, ptr %27, ptr %28, ptr %29, ptr @.offload_maptypes, ptr null, ptr null)
+    // call void @__tgt_target_data_update_mapper(ptr @1, i64 -1, i32 2, ptr %46, ptr %47, ptr %48, ptr @.offload_maptypes.1, ptr null, ptr null)
+    // call void @__tgt_target_data_end_mapper(ptr @1, i64 -1, i32 3, ptr %49, ptr %50, ptr %51, ptr @.offload_maptypes, ptr null, ptr null)
     // What is @1? Random but fixed:
     // @0 = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1
     // @1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 22, ptr @0 }, align 8
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:805:
-
 }
 
 pub(crate) fn run_pass_manager(
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:830:
     // We then run the llvm_optimize function a second time, to optimize the code which we generated
     // in the enzyme differentiation pass.
     let enable_ad = config.autodiff.contains(&config::AutoDiff::Enable);
-    let enable_gpu = true;//config.offload.contains(&config::Offload::Enable);
+    let enable_gpu = true; //config.offload.contains(&config::Offload::Enable);
     let stage = if thin {
         write::AutodiffStage::PreAD
     } else {
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:852:
         let cx =
             SimpleCx::new(module.module_llvm.llmod(), &module.module_llvm.llcx, cgcx.pointer_size);
         if cx.get_function("gen_tgt_offload").is_some() {
-
             let offload_entry_ty = gen_globals(&cx);
 
             dbg!("created struct");
fmt: checked 6049 files
Build completed unsuccessfully in 0:00:44
  local time: Mon Jun  9 04:49:35 UTC 2025
  network time: Mon, 09 Jun 2025 04:49:35 GMT
##[error]Process completed with exit code 1.

rust-log-analyzer avatar Jun 09 '25 04:06 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

COPY host-x86_64/mingw-check-1/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check-1/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 npm install eslint@$(head -n 1 /tmp/eslint.version) && \
 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
DirectMap4k:      137152 kB
DirectMap2M:     7202816 kB
DirectMap1G:    11534336 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 npm install eslint@$(head -n 1 /tmp/eslint.version) &&  python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
+ head -n 1 /tmp/eslint.version
+ TIDY_PRINT_DIFF=1 npm install [email protected]
npm WARN deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated @humanwhocodes/[email protected]: Use @eslint/config-array instead
npm WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm WARN deprecated @humanwhocodes/[email protected]: Use @eslint/object-schema instead
---
     }
-
 }
 
 impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
Diff in /checkout/compiler/rustc_codegen_llvm/src/common.rs:377:
     }
 }
 
-pub(crate) fn named_struct<'ll>(
-    ty: &'ll Type,
-    elts: &[&'ll Value],
-) -> &'ll Value {
+pub(crate) fn named_struct<'ll>(ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
     let len = c_uint::try_from(elts.len()).expect("LLVMConstStructInContext elements len overflow");
     unsafe { llvm::LLVMConstNamedStruct(ty, elts.as_ptr(), len) }
 }
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:6:
 use std::sync::Arc;
 use std::{io, iter, slice};
 
+use llvm::Linkage::*;
 use object::read::archive::ArchiveFile;
 use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule, ThinShared};
 use rustc_codegen_ssa::back::symbol_export;
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:22:
 use rustc_session::config::{self, CrateType, Lto};
 use tracing::{debug, info};
 
-use llvm::Linkage::*;
-
 use crate::back::write::{
     self, CodegenDiagnosticsStage, DiagnosticHandlers, bitcode_section_name, save_temp_bitcode,
 };
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:32:
     DynamicLinkingWithLTO, LlvmError, LtoBitcodeFromRlib, LtoDisallowed, LtoDylib, LtoProcMacro,
 };
 use crate::llvm::AttributePlace::Function;
-use crate::llvm::{self, build_string, Linkage};
+use crate::llvm::{self, Linkage, build_string};
 use crate::{LlvmCodegenBackend, ModuleLlvm, SimpleCx, attributes};
 
 /// We keep track of the computed LTO cache keys from the previous
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:632:
 }
 
 fn gen_globals<'ll>(cx: &'ll SimpleCx<'_>) -> (&'ll llvm::Type, &'ll llvm::Value) {
-            let offload_entry_ty = cx.type_named_struct("struct.__tgt_offload_entry");
-            let kernel_arguments_ty = cx.type_named_struct("struct.__tgt_kernel_arguments");
-            let tptr = cx.type_ptr();
-            let ti64 = cx.type_i64();
-            let ti32 = cx.type_i32();
-            let ti16 = cx.type_i16();
-            let ti8 = cx.type_i8();
-            let tarr = cx.type_array(ti32, 3);
+    let offload_entry_ty = cx.type_named_struct("struct.__tgt_offload_entry");
+    let kernel_arguments_ty = cx.type_named_struct("struct.__tgt_kernel_arguments");
+    let tptr = cx.type_ptr();
+    let ti64 = cx.type_i64();
+    let ti32 = cx.type_i32();
+    let ti16 = cx.type_i16();
+    let ti8 = cx.type_i8();
+    let tarr = cx.type_array(ti32, 3);
 
     // @0 = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1
     let unknown_txt = ";unknown;unknown;0;0;;";
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:651:
 
     // @1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 22, ptr @0 }, align 8
     let struct_ident_ty = cx.type_named_struct("struct.ident_t");
-    let struct_elems: Vec<&llvm::Value> = vec![cx.get_const_i32(0), cx.get_const_i32(2), cx.get_const_i32(0), cx.get_const_i32(22), at_zero];
+    let struct_elems: Vec<&llvm::Value> = vec![
+        cx.get_const_i32(0),
+        cx.get_const_i32(2),
+        cx.get_const_i32(0),
+        cx.get_const_i32(22),
+        at_zero,
+    ];
     let struct_elems_ty: Vec<_> = struct_elems.iter().map(|&x| cx.val_ty(x)).collect();
     let initializer = crate::common::named_struct(struct_ident_ty, &struct_elems);
     cx.set_struct_body(struct_ident_ty, &struct_elems_ty, false);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:658:
     let at_one = add_unnamed_global(&cx, &"", initializer, PrivateLinkage);
     llvm::set_alignment(at_one, rustc_abi::Align::EIGHT);
 
-            // coppied from LLVM
-            // typedef struct {
-            //   uint64_t Reserved;
-            //   uint16_t Version;
-            //   uint16_t Kind;
-            //   uint32_t Flags;
-            //   void *Address;
-            //   char *SymbolName;
-            //   uint64_t Size;
-            //   uint64_t Data;
-            //   void *AuxAddr;
-            // } __tgt_offload_entry;
-            let entry_elements = vec![ti64, ti16, ti16, ti32, tptr, tptr, ti64, ti64, tptr];
-            let kernel_elements = vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
+    // coppied from LLVM
+    // typedef struct {
+    //   uint64_t Reserved;
+    //   uint16_t Version;
+    //   uint16_t Kind;
+    //   uint32_t Flags;
+    //   void *Address;
+    //   char *SymbolName;
+    //   uint64_t Size;
+    //   uint64_t Data;
+    //   void *AuxAddr;
+    // } __tgt_offload_entry;
+    let entry_elements = vec![ti64, ti16, ti16, ti32, tptr, tptr, ti64, ti64, tptr];
+    let kernel_elements =
+        vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
 
-            cx.set_struct_body(offload_entry_ty, &entry_elements, false);
-            cx.set_struct_body(kernel_arguments_ty, &kernel_elements, false);
-            let global = cx.declare_global("my_struct_global", offload_entry_ty);
-            let global = cx.declare_global("my_struct_global2", kernel_arguments_ty);
-            //@my_struct_global = external global %struct.__tgt_offload_entry
-            //@my_struct_global2 = external global %struct.__tgt_kernel_arguments
-            dbg!(&offload_entry_ty);
-            dbg!(&kernel_arguments_ty);
-            //LLVMTypeRef elements[9] = {i64Ty, i16Ty, i16Ty, i32Ty, ptrTy, ptrTy, i64Ty, i64Ty, ptrTy};
-            //LLVMStructSetBody(structTy, elements, 9, 0);
+    cx.set_struct_body(offload_entry_ty, &entry_elements, false);
+    cx.set_struct_body(kernel_arguments_ty, &kernel_elements, false);
+    let global = cx.declare_global("my_struct_global", offload_entry_ty);
+    let global = cx.declare_global("my_struct_global2", kernel_arguments_ty);
+    //@my_struct_global = external global %struct.__tgt_offload_entry
+    //@my_struct_global2 = external global %struct.__tgt_kernel_arguments
+    dbg!(&offload_entry_ty);
+    dbg!(&kernel_arguments_ty);
+    //LLVMTypeRef elements[9] = {i64Ty, i16Ty, i16Ty, i32Ty, ptrTy, ptrTy, i64Ty, i64Ty, ptrTy};
+    //LLVMStructSetBody(structTy, elements, 9, 0);
 
-            // New, to test memtransfer
-            // ; Function Attrs: nounwind
-            // declare void @__tgt_target_data_begin_mapper(ptr, i64, i32, ptr, ptr, ptr, ptr, ptr, ptr) #3
-            //
-            // ; Function Attrs: nounwind
-            // declare void @__tgt_target_data_update_mapper(ptr, i64, i32, ptr, ptr, ptr, ptr, ptr, ptr) #3
-            //
-            // ; Function Attrs: nounwind
-            // declare void @__tgt_target_data_end_mapper(ptr, i64, i32, ptr, ptr, ptr, ptr, ptr, ptr) #3
+    // New, to test memtransfer
+    // ; Function Attrs: nounwind
+    // declare void @__tgt_target_data_begin_mapper(ptr, i64, i32, ptr, ptr, ptr, ptr, ptr, ptr) #3
+    //
+    // ; Function Attrs: nounwind
+    // declare void @__tgt_target_data_update_mapper(ptr, i64, i32, ptr, ptr, ptr, ptr, ptr, ptr) #3
+    //
+    // ; Function Attrs: nounwind
+    // declare void @__tgt_target_data_end_mapper(ptr, i64, i32, ptr, ptr, ptr, ptr, ptr, ptr) #3
 
-            let mapper_begin = "__tgt_target_data_begin_mapper";
-            let mapper_update = String::from("__tgt_target_data_update_mapper");
-            let mapper_end = String::from("__tgt_target_data_end_mapper");
-            let args = vec![tptr, ti64, ti32, tptr, tptr, tptr, tptr, tptr, tptr];
-            let mapper_fn_ty = cx.type_func(&args, cx.type_void());
-            let foo = crate::declare::declare_simple_fn(&cx, &mapper_begin, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
-            let bar = crate::declare::declare_simple_fn(&cx, &mapper_update, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
-            let baz = crate::declare::declare_simple_fn(&cx, &mapper_end, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
-            let nounwind = llvm::AttributeKind::NoUnwind.create_attr(cx.llcx);
-            attributes::apply_to_llfn(foo, Function, &[nounwind]);
-            attributes::apply_to_llfn(bar, Function, &[nounwind]);
-            attributes::apply_to_llfn(baz, Function, &[nounwind]);
+    let mapper_begin = "__tgt_target_data_begin_mapper";
+    let mapper_update = String::from("__tgt_target_data_update_mapper");
+    let mapper_end = String::from("__tgt_target_data_end_mapper");
+    let args = vec![tptr, ti64, ti32, tptr, tptr, tptr, tptr, tptr, tptr];
+    let mapper_fn_ty = cx.type_func(&args, cx.type_void());
+    let foo = crate::declare::declare_simple_fn(
+        &cx,
+        &mapper_begin,
+        llvm::CallConv::CCallConv,
+        llvm::UnnamedAddr::No,
+        llvm::Visibility::Default,
+        mapper_fn_ty,
+    );
+    let bar = crate::declare::declare_simple_fn(
+        &cx,
---
+        llvm::UnnamedAddr::No,
+        llvm::Visibility::Default,
+        mapper_fn_ty,
+    );
+    let nounwind = llvm::AttributeKind::NoUnwind.create_attr(cx.llcx);
+    attributes::apply_to_llfn(foo, Function, &[nounwind]);
+    attributes::apply_to_llfn(bar, Function, &[nounwind]);
+    attributes::apply_to_llfn(baz, Function, &[nounwind]);
 
-            (offload_entry_ty, at_one)
+    (offload_entry_ty, at_one)
 }
 
-fn add_priv_unnamed_arr<'ll>(cx: &SimpleCx<'ll>, name: &str, vals: &[u64]) -> &'ll llvm::Value{
+fn add_priv_unnamed_arr<'ll>(cx: &SimpleCx<'ll>, name: &str, vals: &[u64]) -> &'ll llvm::Value {
     let ti64 = cx.type_i64();
     let size_ty = cx.type_array(ti64, vals.len() as u64);
     let mut size_val = Vec::with_capacity(vals.len());
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:721:
     add_unnamed_global(cx, name, initializer, PrivateLinkage)
 }
 
-fn add_unnamed_global<'ll>(cx: &SimpleCx<'ll>, name: &str, initializer: &'ll llvm::Value, l: Linkage) -> &'ll llvm::Value {
+fn add_unnamed_global<'ll>(
+    cx: &SimpleCx<'ll>,
+    name: &str,
+    initializer: &'ll llvm::Value,
+    l: Linkage,
+) -> &'ll llvm::Value {
     let llglobal = add_global(cx, name, initializer, l);
-    unsafe {llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global)};
+    unsafe { llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global) };
     llglobal
 }
 
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:730:
-fn add_global<'ll>(cx: &SimpleCx<'ll>, name: &str, initializer: &'ll llvm::Value, l: Linkage) -> &'ll llvm::Value {
+fn add_global<'ll>(
+    cx: &SimpleCx<'ll>,
+    name: &str,
+    initializer: &'ll llvm::Value,
+    l: Linkage,
+) -> &'ll llvm::Value {
     let c_name = CString::new(name).unwrap();
     let llglobal: &'ll llvm::Value = llvm::add_global(cx.llmod, cx.val_ty(initializer), &c_name);
     llvm::set_global_constant(llglobal, true);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:736:
     llglobal
 }
 
-
-
 fn gen_define_handling<'ll>(cx: &'ll SimpleCx<'_>, offload_entry_ty: &'ll llvm::Type, num: i64) {
-                // We add a pair of sizes and maptypes per offloadable function.
-                // @.offload_maptypes = private unnamed_addr constant [4 x i64] [i64 800, i64 544, i64 547, i64 544]
-                let o_sizes = add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![8u64,0,16,0]);
-                let o_types = add_priv_unnamed_arr(&cx, &format!(".offload_maptypes.{num}"), &vec![800u64, 544, 547, 544]);
-                // TODO: We should add another pair per call to offloadable functions
-                // @.offload_sizes.5 = private unnamed_addr constant [2 x i64] [i64 16384, i64 16384]
-                // @.offload_maptypes.6 = private unnamed_addr constant [2 x i64] [i64 1, i64 3]
+    // We add a pair of sizes and maptypes per offloadable function.
+    // @.offload_maptypes = private unnamed_addr constant [4 x i64] [i64 800, i64 544, i64 547, i64 544]
+    let o_sizes =
+        add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![8u64, 0, 16, 0]);
+    let o_types = add_priv_unnamed_arr(
+        &cx,
+        &format!(".offload_maptypes.{num}"),
+        &vec![800u64, 544, 547, 544],
+    );
+    // TODO: We should add another pair per call to offloadable functions
+    // @.offload_sizes.5 = private unnamed_addr constant [2 x i64] [i64 16384, i64 16384]
+    // @.offload_maptypes.6 = private unnamed_addr constant [2 x i64] [i64 1, i64 3]
 
-                // Next: For each function, generate these three entries. A weak constant,
-                // the llvm.rodata entry name, and  the omp_offloading_entries value
+    // Next: For each function, generate these three entries. A weak constant,
+    // the llvm.rodata entry name, and  the omp_offloading_entries value
 
-                // @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id = weak constant i8 0
-                // @.offloading.entry_name = internal unnamed_addr constant [66 x i8] c"__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7\00", section ".llvm.rodata.offloading", align 1
-                let name = format!(".kernel_{num}.region_id");
-                let initializer = cx.get_const_i8(0);
-                let region_id = add_unnamed_global(&cx, &name, initializer, WeakAnyLinkage);
+    // @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id = weak constant i8 0
+    // @.offloading.entry_name = internal unnamed_addr constant [66 x i8] c"__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7\00", section ".llvm.rodata.offloading", align 1
+    let name = format!(".kernel_{num}.region_id");
+    let initializer = cx.get_const_i8(0);
+    let region_id = add_unnamed_global(&cx, &name, initializer, WeakAnyLinkage);
 
-                let c_entry_name = CString::new(format!("kernel_{num}")).unwrap();
-                let c_val = c_entry_name.as_bytes_with_nul();
-                let foo = format!(".offloading.entry_name.{num}");
+    let c_entry_name = CString::new(format!("kernel_{num}")).unwrap();
+    let c_val = c_entry_name.as_bytes_with_nul();
+    let foo = format!(".offloading.entry_name.{num}");
 
-                let initializer = crate::common::bytes_in_context(cx.llcx, c_val);
-                let llglobal = add_unnamed_global(&cx, &foo, initializer, InternalLinkage);
-                llvm::set_alignment(llglobal, rustc_abi::Align::ONE);
-                let c_section_name = CString::new(".llvm.rodata.offloading").unwrap();
-                llvm::set_section(llglobal, &c_section_name);
+    let initializer = crate::common::bytes_in_context(cx.llcx, c_val);
+    let llglobal = add_unnamed_global(&cx, &foo, initializer, InternalLinkage);
+    llvm::set_alignment(llglobal, rustc_abi::Align::ONE);
+    let c_section_name = CString::new(".llvm.rodata.offloading").unwrap();
+    llvm::set_section(llglobal, &c_section_name);
 
+    // Not actively used yet, for calling real kernels
+    let name = format!(".offloading.entry.kernel_{num}");
+    let ci64_0 = cx.get_const_i64(0);
+    let ci16_1 = cx.get_const_i16(1);
+    let elems: Vec<&llvm::Value> = vec![
+        ci64_0,
+        ci16_1,
+        ci16_1,
+        cx.get_const_i32(0),
+        region_id,
+        llglobal,
+        ci64_0,
+        ci64_0,
+        cx.const_null(cx.type_ptr()),
+    ];
 
-                // Not actively used yet, for calling real kernels
-                let name = format!(".offloading.entry.kernel_{num}");
-                let ci64_0 = cx.get_const_i64(0);
-                let ci16_1 = cx.get_const_i16(1);
-                let elems: Vec<&llvm::Value> = vec![ci64_0, ci16_1, ci16_1, cx.get_const_i32(0), region_id, llglobal, ci64_0, ci64_0, cx.const_null(cx.type_ptr())];
+    let initializer = crate::common::named_struct(offload_entry_ty, &elems);
+    let c_name = CString::new(name).unwrap();
+    let llglobal = llvm::add_global(cx.llmod, offload_entry_ty, &c_name);
+    llvm::set_global_constant(llglobal, true);
+    llvm::set_linkage(llglobal, WeakAnyLinkage);
+    llvm::set_initializer(llglobal, initializer);
+    llvm::set_alignment(llglobal, rustc_abi::Align::ONE);
+    let c_section_name = CString::new(".omp_offloading_entries").unwrap();
+    llvm::set_section(llglobal, &c_section_name);
+    // rustc
+    // @.offloading.entry.kernel_3 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.kernel_3.region_id, ptr @.offloading.entry_name.3, i64 0, i64 0, ptr null }, section ".omp_offloading_entries", align 1
+    // clang
+    // @.offloading.entry.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }, section "omp_offloading_entries", align 1
 
-                let initializer = crate::common::named_struct(offload_entry_ty, &elems);
-                let c_name = CString::new(name).unwrap();
-                let llglobal = llvm::add_global(cx.llmod, offload_entry_ty, &c_name);
-                llvm::set_global_constant(llglobal, true);
-                llvm::set_linkage(llglobal, WeakAnyLinkage);
-                llvm::set_initializer(llglobal, initializer);
-                llvm::set_alignment(llglobal, rustc_abi::Align::ONE);
-                let c_section_name = CString::new(".omp_offloading_entries").unwrap();
-                llvm::set_section(llglobal, &c_section_name);
-                // rustc
-                // @.offloading.entry.kernel_3 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.kernel_3.region_id, ptr @.offloading.entry_name.3, i64 0, i64 0, ptr null }, section ".omp_offloading_entries", align 1
-                // clang
-                // @.offloading.entry.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }, section "omp_offloading_entries", align 1
-
-
-                //
-                // 1. @.offload_sizes.{num} = private unnamed_addr constant [4 x i64] [i64 8, i64 0, i64 16, i64 0]
-                // 2. @.offload_maptypes
-                // 3. @.__omp_offloading_<hash>_fnc_name_<hash> = weak constant i8 0
-                // 4. @.offloading.entry_name = internal unnamed_addr constant [66 x i8] c"__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7\00", section ".llvm.rodata.offloading", align 1
-                // 5. @.offloading.entry.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }, section "omp_offloading_entries", align 1
+    //
+    // 1. @.offload_sizes.{num} = private unnamed_addr constant [4 x i64] [i64 8, i64 0, i64 16, i64 0]
+    // 2. @.offload_maptypes
+    // 3. @.__omp_offloading_<hash>_fnc_name_<hash> = weak constant i8 0
+    // 4. @.offloading.entry_name = internal unnamed_addr constant [66 x i8] c"__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7\00", section ".llvm.rodata.offloading", align 1
+    // 5. @.offloading.entry.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }, section "omp_offloading_entries", align 1
 }
 
 fn gen_call_handling<'ll>(cx: &'ll SimpleCx<'_>, s_ident_t: &'ll llvm::Value) {
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:800:
     let builder = SBuilder::build(cx);
-            // call void @__tgt_target_data_begin_mapper(ptr @1, i64 -1, i32 3, ptr %27, ptr %28, ptr %29, ptr @.offload_maptypes, ptr null, ptr null)
-            // call void @__tgt_target_data_update_mapper(ptr @1, i64 -1, i32 2, ptr %46, ptr %47, ptr %48, ptr @.offload_maptypes.1, ptr null, ptr null)
-            // call void @__tgt_target_data_end_mapper(ptr @1, i64 -1, i32 3, ptr %49, ptr %50, ptr %51, ptr @.offload_maptypes, ptr null, ptr null)
+    // call void @__tgt_target_data_begin_mapper(ptr @1, i64 -1, i32 3, ptr %27, ptr %28, ptr %29, ptr @.offload_maptypes, ptr null, ptr null)
+    // call void @__tgt_target_data_update_mapper(ptr @1, i64 -1, i32 2, ptr %46, ptr %47, ptr %48, ptr @.offload_maptypes.1, ptr null, ptr null)
+    // call void @__tgt_target_data_end_mapper(ptr @1, i64 -1, i32 3, ptr %49, ptr %50, ptr %51, ptr @.offload_maptypes, ptr null, ptr null)
     // What is @1? Random but fixed:
     // @0 = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1
     // @1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 22, ptr @0 }, align 8
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:807:
-
 }
 
 pub(crate) fn run_pass_manager(
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:832:
     // We then run the llvm_optimize function a second time, to optimize the code which we generated
     // in the enzyme differentiation pass.
     let enable_ad = config.autodiff.contains(&config::AutoDiff::Enable);
-    let enable_gpu = true;//config.offload.contains(&config::Offload::Enable);
+    let enable_gpu = true; //config.offload.contains(&config::Offload::Enable);
     let stage = if thin {
         write::AutodiffStage::PreAD
     } else {
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:854:
         let cx =
             SimpleCx::new(module.module_llvm.llmod(), &module.module_llvm.llcx, cgcx.pointer_size);
         if cx.get_function("gen_tgt_offload").is_some() {
-
             let (offload_entry_ty, at_one) = gen_globals(&cx);
 
             dbg!("created struct");
Diff in /checkout/compiler/rustc_session/src/config.rs:3068:
     };
 
     use super::{
-        AutoDiff, Offload, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
+        AutoDiff, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
         CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FmtDebug, FunctionReturn,
         InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
-        LtoCli, MirStripDebugInfo, NextSolverConfig, OomStrategy, OptLevel, OutFileName,
+        LtoCli, MirStripDebugInfo, NextSolverConfig, Offload, OomStrategy, OptLevel, OutFileName,
         OutputType, OutputTypes, PatchableFunctionEntry, Polonius, RemapPathScopeComponents,
         ResolveDocLinks, SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath,
         SymbolManglingVersion, WasiExecModel,
fmt: checked 6051 files
Build completed unsuccessfully in 0:00:47
  local time: Mon Jun  9 05:40:39 UTC 2025
  network time: Mon, 09 Jun 2025 05:40:39 GMT
##[error]Process completed with exit code 1.

rust-log-analyzer avatar Jun 09 '25 05:06 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Diff in /checkout/compiler/rustc_session/src/config.rs:3068:
     };
 
     use super::{
-        AutoDiff, Offload, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
+        AutoDiff, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
         CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FmtDebug, FunctionReturn,
         InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
-        LtoCli, MirStripDebugInfo, NextSolverConfig, OomStrategy, OptLevel, OutFileName,
+        LtoCli, MirStripDebugInfo, NextSolverConfig, Offload, OomStrategy, OptLevel, OutFileName,
         OutputType, OutputTypes, PatchableFunctionEntry, Polonius, RemapPathScopeComponents,
         ResolveDocLinks, SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath,
         SymbolManglingVersion, WasiExecModel,
Diff in /checkout/compiler/rustc_codegen_llvm/src/declare.rs:99:
             )
         }
     }
-
 }
 
 impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
Diff in /checkout/compiler/rustc_codegen_llvm/src/common.rs:377:
     }
 }
 
-pub(crate) fn named_struct<'ll>(
-    ty: &'ll Type,
-    elts: &[&'ll Value],
-) -> &'ll Value {
+pub(crate) fn named_struct<'ll>(ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
     let len = c_uint::try_from(elts.len()).expect("LLVMConstStructInContext elements len overflow");
     unsafe { llvm::LLVMConstNamedStruct(ty, elts.as_ptr(), len) }
 }
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:6:
 use std::sync::Arc;
 use std::{io, iter, slice};
 
+use llvm::Linkage::*;
 use object::read::archive::ArchiveFile;
 use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule, ThinShared};
 use rustc_codegen_ssa::back::symbol_export;
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:22:
 use rustc_session::config::{self, CrateType, Lto};
 use tracing::{debug, info};
 
-use llvm::Linkage::*;
-
 use crate::back::write::{
     self, CodegenDiagnosticsStage, DiagnosticHandlers, bitcode_section_name, save_temp_bitcode,
 };
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:30:
 use crate::builder::SBuilder;
+use crate::common::AsCCharPtr;
 use crate::errors::{
     DynamicLinkingWithLTO, LlvmError, LtoBitcodeFromRlib, LtoDisallowed, LtoDylib, LtoProcMacro,
 };
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:34:
-use crate::common::AsCCharPtr;
 use crate::llvm::AttributePlace::Function;
-use crate::llvm::{self, build_string, Linkage};
+use crate::llvm::{self, Linkage, build_string};
 use crate::{LlvmCodegenBackend, ModuleLlvm, SimpleCx, attributes};
 
 /// We keep track of the computed LTO cache keys from the previous
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:43:
 fn crate_type_allows_lto(crate_type: CrateType) -> bool {
     match crate_type {
         CrateType::Executable
-            | CrateType::Dylib
-            | CrateType::Staticlib
-            | CrateType::Cdylib
-            | CrateType::ProcMacro
-            | CrateType::Sdylib => true,
+        | CrateType::Dylib
+        | CrateType::Staticlib
+        | CrateType::Cdylib
+        | CrateType::ProcMacro
+        | CrateType::Sdylib => true,
         CrateType::Rlib => false,
     }
 }
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:117:
                     cgcx.prof.generic_activity("LLVM_lto_generate_symbols_below_threshold");
                 symbols_below_threshold
                     .extend(exported_symbols[&cnum].iter().filter_map(symbol_filter));
-                }
+            }
 
             let archive_data = unsafe {
                 Mmap::map(std::fs::File::open(&path).expect("couldn't open rlib"))
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:131:
                         std::str::from_utf8(c.name()).ok().map(|name| (name.trim(), c))
                     })
                 })
-            .filter(|&(name, _)| looks_like_rust_object_file(name));
+                .filter(|&(name, _)| looks_like_rust_object_file(name));
             for (name, child) in obj_files {
                 info!("adding bitcode from {}", name);
                 match get_bitcode_slice_from_object_data(
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:299:
             let cost = unsafe { llvm::LLVMRustModuleCost(module.module_llvm.llmod()) };
             (cost, i)
         })
-    .max();
+        .max();
 
     // If we found a costliest module, we're good to go. Otherwise all our
     // inputs were serialized which could happen in the case, for example, that
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:510:
             symbols_below_threshold.as_ptr(),
             symbols_below_threshold.len(),
         )
-            .ok_or_else(|| write::llvm_err(dcx, LlvmError::PrepareThinLtoContext))?;
+        .ok_or_else(|| write::llvm_err(dcx, LlvmError::PrepareThinLtoContext))?;
 
         let data = ThinData(data);
 
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:652:
 
     // @1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 22, ptr @0 }, align 8
     let struct_ident_ty = cx.type_named_struct("struct.ident_t");
-    let struct_elems: Vec<&llvm::Value> = vec![cx.get_const_i32(0), cx.get_const_i32(2), cx.get_const_i32(0), cx.get_const_i32(22), at_zero];
+    let struct_elems: Vec<&llvm::Value> = vec![
+        cx.get_const_i32(0),
+        cx.get_const_i32(2),
+        cx.get_const_i32(0),
+        cx.get_const_i32(22),
+        at_zero,
+    ];
     let struct_elems_ty: Vec<_> = struct_elems.iter().map(|&x| cx.val_ty(x)).collect();
     let initializer = crate::common::named_struct(struct_ident_ty, &struct_elems);
     cx.set_struct_body(struct_ident_ty, &struct_elems_ty, false);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:672:
     //   void *AuxAddr;
     // } __tgt_offload_entry;
     let entry_elements = vec![ti64, ti16, ti16, ti32, tptr, tptr, ti64, ti64, tptr];
-    let kernel_elements = vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
+    let kernel_elements =
+        vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
 
     cx.set_struct_body(offload_entry_ty, &entry_elements, false);
     cx.set_struct_body(kernel_arguments_ty, &kernel_elements, false);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:700:
     let mapper_end = String::from("__tgt_target_data_end_mapper");
     let args = vec![tptr, ti64, ti32, tptr, tptr, tptr, tptr, tptr, tptr];
     let mapper_fn_ty = cx.type_func(&args, cx.type_void());
-    let foo = crate::declare::declare_simple_fn(&cx, &mapper_begin, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
-    let bar = crate::declare::declare_simple_fn(&cx, &mapper_update, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
-    let baz = crate::declare::declare_simple_fn(&cx, &mapper_end, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
+    let foo = crate::declare::declare_simple_fn(
+        &cx,
+        &mapper_begin,
+        llvm::CallConv::CCallConv,
+        llvm::UnnamedAddr::No,
+        llvm::Visibility::Default,
+        mapper_fn_ty,
+    );
+    let bar = crate::declare::declare_simple_fn(
+        &cx,
---
+        llvm::UnnamedAddr::No,
+        llvm::Visibility::Default,
+        mapper_fn_ty,
+    );
     let nounwind = llvm::AttributeKind::NoUnwind.create_attr(cx.llcx);
     attributes::apply_to_llfn(foo, Function, &[nounwind]);
     attributes::apply_to_llfn(bar, Function, &[nounwind]);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:711:
     (offload_entry_ty, at_one)
 }
 
-fn add_priv_unnamed_arr<'ll>(cx: &SimpleCx<'ll>, name: &str, vals: &[u64]) -> &'ll llvm::Value{
+fn add_priv_unnamed_arr<'ll>(cx: &SimpleCx<'ll>, name: &str, vals: &[u64]) -> &'ll llvm::Value {
     let ti64 = cx.type_i64();
     let size_ty = cx.type_array(ti64, vals.len() as u64);
     let mut size_val = Vec::with_capacity(vals.len());
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:722:
     add_unnamed_global(cx, name, initializer, PrivateLinkage)
 }
 
-fn add_unnamed_global<'ll>(cx: &SimpleCx<'ll>, name: &str, initializer: &'ll llvm::Value, l: Linkage) -> &'ll llvm::Value {
+fn add_unnamed_global<'ll>(
+    cx: &SimpleCx<'ll>,
+    name: &str,
+    initializer: &'ll llvm::Value,
+    l: Linkage,
+) -> &'ll llvm::Value {
     let llglobal = add_global(cx, name, initializer, l);
-    unsafe {llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global)};
+    unsafe { llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global) };
     llglobal
 }
 
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:731:
-fn add_global<'ll>(cx: &SimpleCx<'ll>, name: &str, initializer: &'ll llvm::Value, l: Linkage) -> &'ll llvm::Value {
+fn add_global<'ll>(
+    cx: &SimpleCx<'ll>,
+    name: &str,
+    initializer: &'ll llvm::Value,
+    l: Linkage,
+) -> &'ll llvm::Value {
     let c_name = CString::new(name).unwrap();
     let llglobal: &'ll llvm::Value = llvm::add_global(cx.llmod, cx.val_ty(initializer), &c_name);
     llvm::set_global_constant(llglobal, true);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:737:
     llglobal
 }
 
-
-
 fn gen_define_handling<'ll>(cx: &'ll SimpleCx<'_>, offload_entry_ty: &'ll llvm::Type, num: i64) {
     // We add a pair of sizes and maptypes per offloadable function.
     // @.offload_maptypes = private unnamed_addr constant [4 x i64] [i64 800, i64 544, i64 547, i64 544]
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:745:
-    let o_sizes = add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![8u64,0,16,0]);
-    let o_types = add_priv_unnamed_arr(&cx, &format!(".offload_maptypes.{num}"), &vec![800u64, 544, 547, 544]);
+    let o_sizes =
+        add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![8u64, 0, 16, 0]);
+    let o_types = add_priv_unnamed_arr(
+        &cx,
+        &format!(".offload_maptypes.{num}"),
+        &vec![800u64, 544, 547, 544],
+    );
     // TODO: We should add another pair per call to offloadable functions
     // @.offload_sizes.5 = private unnamed_addr constant [2 x i64] [i64 16384, i64 16384]
     // @.offload_maptypes.6 = private unnamed_addr constant [2 x i64] [i64 1, i64 3]
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:767:
     let c_section_name = CString::new(".llvm.rodata.offloading").unwrap();
     llvm::set_section(llglobal, &c_section_name);
 
-
     // Not actively used yet, for calling real kernels
     let name = format!(".offloading.entry.kernel_{num}");
     let ci64_0 = cx.get_const_i64(0);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:774:
     let ci16_1 = cx.get_const_i16(1);
-    let elems: Vec<&llvm::Value> = vec![ci64_0, ci16_1, ci16_1, cx.get_const_i32(0), region_id, llglobal, ci64_0, ci64_0, cx.const_null(cx.type_ptr())];
+    let elems: Vec<&llvm::Value> = vec![
+        ci64_0,
+        ci16_1,
+        ci16_1,
+        cx.get_const_i32(0),
+        region_id,
+        llglobal,
+        ci64_0,
+        ci64_0,
+        cx.const_null(cx.type_ptr()),
+    ];
 
     let initializer = crate::common::named_struct(offload_entry_ty, &elems);
     let c_name = CString::new(name).unwrap();
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:788:
     // clang
     // @.offloading.entry.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }, section "omp_offloading_entries", align 1
 
-
     //
     // 1. @.offload_sizes.{num} = private unnamed_addr constant [4 x i64] [i64 8, i64 0, i64 16, i64 0]
     // 2. @.offload_maptypes
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:798:
 }
 
 fn gen_call_handling<'ll>(cx: &'ll SimpleCx<'_>, s_ident_t: &'ll llvm::Value) {
-
     let main_fn = cx.get_function("main");
     if let Some(main_fn) = main_fn {
-        let kernel_name = "kernel_1";//name.as_c_char_ptr(), name.len)
-        let call = unsafe {llvm::LLVMRustGetFunctionCall(main_fn, kernel_name.as_c_char_ptr(), kernel_name.len())};
+        let kernel_name = "kernel_1"; //name.as_c_char_ptr(), name.len)
+        let call = unsafe {
+            llvm::LLVMRustGetFunctionCall(main_fn, kernel_name.as_c_char_ptr(), kernel_name.len())
+        };
         let kernel_call = if call.is_some() {
             dbg!("found kernel call");
             call.unwrap()
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:809:
         } else {
             return;
         };
-        let kernel_call_bb = unsafe {llvm::LLVMGetInstructionParent(kernel_call)};
+        let kernel_call_bb = unsafe { llvm::LLVMGetInstructionParent(kernel_call) };
         let builder = SBuilder::build(cx, kernel_call_bb);
-        unsafe {llvm::LLVMRustPositionBefore(builder.llbuilder, kernel_call)};
+        unsafe { llvm::LLVMRustPositionBefore(builder.llbuilder, kernel_call) };
         dbg!("positioned builder, ready");
 
         // 1. set insert point before kernel call.
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:857:
     // We then run the llvm_optimize function a second time, to optimize the code which we generated
     // in the enzyme differentiation pass.
     let enable_ad = config.autodiff.contains(&config::AutoDiff::Enable);
-    let enable_gpu = true;//config.offload.contains(&config::Offload::Enable);
+    let enable_gpu = true; //config.offload.contains(&config::Offload::Enable);
     let stage = if thin {
         write::AutodiffStage::PreAD
     } else {
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:879:
         let cx =
             SimpleCx::new(module.module_llvm.llmod(), &module.module_llvm.llcx, cgcx.pointer_size);
         if cx.get_function("gen_tgt_offload").is_some() {
-
             let (offload_entry_ty, at_one) = gen_globals(&cx);
 
             dbg!("created struct");
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:1166:
                 .expect("Invalid ThinLTO module key");
                 (module_name_to_str(name).to_string(), key)
             })
-        .collect();
+            .collect();
         Self { keys }
     }

rust-log-analyzer avatar Jun 09 '25 18:06 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
     }
-
 }
 
 impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
Diff in /checkout/compiler/rustc_codegen_llvm/src/common.rs:377:
     }
 }
 
-pub(crate) fn named_struct<'ll>(
-    ty: &'ll Type,
-    elts: &[&'ll Value],
-) -> &'ll Value {
+pub(crate) fn named_struct<'ll>(ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
     let len = c_uint::try_from(elts.len()).expect("LLVMConstStructInContext elements len overflow");
     unsafe { llvm::LLVMConstNamedStruct(ty, elts.as_ptr(), len) }
 }
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:6:
 use std::sync::Arc;
 use std::{io, iter, slice};
 
+use llvm::Linkage::*;
 use object::read::archive::ArchiveFile;
 use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule, ThinShared};
 use rustc_codegen_ssa::back::symbol_export;
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:22:
 use rustc_session::config::{self, CrateType, Lto};
 use tracing::{debug, info};
 
-use llvm::Linkage::*;
-
 use crate::back::write::{
     self, CodegenDiagnosticsStage, DiagnosticHandlers, bitcode_section_name, save_temp_bitcode,
 };
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:30:
 use crate::builder::SBuilder;
+use crate::common::AsCCharPtr;
 use crate::errors::{
     DynamicLinkingWithLTO, LlvmError, LtoBitcodeFromRlib, LtoDisallowed, LtoDylib, LtoProcMacro,
 };
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:34:
-use crate::common::AsCCharPtr;
 use crate::llvm::AttributePlace::Function;
-use crate::llvm::{self, build_string, Linkage};
+use crate::llvm::{self, Linkage, build_string};
 use crate::{LlvmCodegenBackend, ModuleLlvm, SimpleCx, attributes};
 
 /// We keep track of the computed LTO cache keys from the previous
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:43:
 fn crate_type_allows_lto(crate_type: CrateType) -> bool {
     match crate_type {
         CrateType::Executable
-            | CrateType::Dylib
-            | CrateType::Staticlib
-            | CrateType::Cdylib
-            | CrateType::ProcMacro
-            | CrateType::Sdylib => true,
+        | CrateType::Dylib
+        | CrateType::Staticlib
+        | CrateType::Cdylib
+        | CrateType::ProcMacro
+        | CrateType::Sdylib => true,
         CrateType::Rlib => false,
     }
 }
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:117:
                     cgcx.prof.generic_activity("LLVM_lto_generate_symbols_below_threshold");
                 symbols_below_threshold
                     .extend(exported_symbols[&cnum].iter().filter_map(symbol_filter));
-                }
+            }
 
             let archive_data = unsafe {
                 Mmap::map(std::fs::File::open(&path).expect("couldn't open rlib"))
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:131:
                         std::str::from_utf8(c.name()).ok().map(|name| (name.trim(), c))
                     })
                 })
-            .filter(|&(name, _)| looks_like_rust_object_file(name));
+                .filter(|&(name, _)| looks_like_rust_object_file(name));
             for (name, child) in obj_files {
                 info!("adding bitcode from {}", name);
                 match get_bitcode_slice_from_object_data(
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:299:
             let cost = unsafe { llvm::LLVMRustModuleCost(module.module_llvm.llmod()) };
             (cost, i)
         })
-    .max();
+        .max();
 
     // If we found a costliest module, we're good to go. Otherwise all our
     // inputs were serialized which could happen in the case, for example, that
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:510:
             symbols_below_threshold.as_ptr(),
             symbols_below_threshold.len(),
         )
-            .ok_or_else(|| write::llvm_err(dcx, LlvmError::PrepareThinLtoContext))?;
+        .ok_or_else(|| write::llvm_err(dcx, LlvmError::PrepareThinLtoContext))?;
 
         let data = ThinData(data);
 
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:632:
     llvm::set_rust_rules(true);
 }
 
-fn gen_globals<'ll>(cx: &'ll SimpleCx<'_>) -> (&'ll llvm::Type, &'ll llvm::Value, &'ll llvm::Value, &'ll llvm::Value, &'ll llvm::Value, &'ll llvm::Type) {
+fn gen_globals<'ll>(
+    cx: &'ll SimpleCx<'_>,
+) -> (
+    &'ll llvm::Type,
+    &'ll llvm::Value,
+    &'ll llvm::Value,
+    &'ll llvm::Value,
+    &'ll llvm::Value,
+    &'ll llvm::Type,
+) {
     let offload_entry_ty = cx.type_named_struct("struct.__tgt_offload_entry");
     let kernel_arguments_ty = cx.type_named_struct("struct.__tgt_kernel_arguments");
     let tptr = cx.type_ptr();
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:652:
 
     // @1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 22, ptr @0 }, align 8
     let struct_ident_ty = cx.type_named_struct("struct.ident_t");
-    let struct_elems: Vec<&llvm::Value> = vec![cx.get_const_i32(0), cx.get_const_i32(2), cx.get_const_i32(0), cx.get_const_i32(22), at_zero];
+    let struct_elems: Vec<&llvm::Value> = vec![
+        cx.get_const_i32(0),
+        cx.get_const_i32(2),
+        cx.get_const_i32(0),
+        cx.get_const_i32(22),
+        at_zero,
+    ];
     let struct_elems_ty: Vec<_> = struct_elems.iter().map(|&x| cx.val_ty(x)).collect();
     let initializer = crate::common::named_struct(struct_ident_ty, &struct_elems);
     cx.set_struct_body(struct_ident_ty, &struct_elems_ty, false);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:672:
     //   void *AuxAddr;
     // } __tgt_offload_entry;
     let entry_elements = vec![ti64, ti16, ti16, ti32, tptr, tptr, ti64, ti64, tptr];
-    let kernel_elements = vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
+    let kernel_elements =
+        vec![ti32, ti32, tptr, tptr, tptr, tptr, tptr, tptr, ti64, ti64, tarr, tarr, ti32];
 
     cx.set_struct_body(offload_entry_ty, &entry_elements, false);
     cx.set_struct_body(kernel_arguments_ty, &kernel_elements, false);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:700:
     let mapper_end = String::from("__tgt_target_data_end_mapper");
     let args = vec![tptr, ti64, ti32, tptr, tptr, tptr, tptr, tptr, tptr];
     let mapper_fn_ty = cx.type_func(&args, cx.type_void());
-    let foo = crate::declare::declare_simple_fn(&cx, &mapper_begin, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
-    let bar = crate::declare::declare_simple_fn(&cx, &mapper_update, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
-    let baz = crate::declare::declare_simple_fn(&cx, &mapper_end, llvm::CallConv::CCallConv, llvm::UnnamedAddr::No, llvm::Visibility::Default, mapper_fn_ty);
+    let foo = crate::declare::declare_simple_fn(
+        &cx,
+        &mapper_begin,
+        llvm::CallConv::CCallConv,
+        llvm::UnnamedAddr::No,
+        llvm::Visibility::Default,
+        mapper_fn_ty,
+    );
+    let bar = crate::declare::declare_simple_fn(
+        &cx,
---
+        llvm::UnnamedAddr::No,
+        llvm::Visibility::Default,
+        mapper_fn_ty,
+    );
     let nounwind = llvm::AttributeKind::NoUnwind.create_attr(cx.llcx);
     attributes::apply_to_llfn(foo, Function, &[nounwind]);
     attributes::apply_to_llfn(bar, Function, &[nounwind]);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:711:
     (offload_entry_ty, at_one, foo, bar, baz, mapper_fn_ty)
 }
 
-fn add_priv_unnamed_arr<'ll>(cx: &SimpleCx<'ll>, name: &str, vals: &[u64]) -> &'ll llvm::Value{
+fn add_priv_unnamed_arr<'ll>(cx: &SimpleCx<'ll>, name: &str, vals: &[u64]) -> &'ll llvm::Value {
     let ti64 = cx.type_i64();
     let size_ty = cx.type_array(ti64, vals.len() as u64);
     let mut size_val = Vec::with_capacity(vals.len());
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:722:
     add_unnamed_global(cx, name, initializer, PrivateLinkage)
 }
 
-fn add_unnamed_global<'ll>(cx: &SimpleCx<'ll>, name: &str, initializer: &'ll llvm::Value, l: Linkage) -> &'ll llvm::Value {
+fn add_unnamed_global<'ll>(
+    cx: &SimpleCx<'ll>,
+    name: &str,
+    initializer: &'ll llvm::Value,
+    l: Linkage,
+) -> &'ll llvm::Value {
     let llglobal = add_global(cx, name, initializer, l);
-    unsafe {llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global)};
+    unsafe { llvm::LLVMSetUnnamedAddress(llglobal, llvm::UnnamedAddr::Global) };
     llglobal
 }
 
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:731:
-fn add_global<'ll>(cx: &SimpleCx<'ll>, name: &str, initializer: &'ll llvm::Value, l: Linkage) -> &'ll llvm::Value {
+fn add_global<'ll>(
+    cx: &SimpleCx<'ll>,
+    name: &str,
+    initializer: &'ll llvm::Value,
+    l: Linkage,
+) -> &'ll llvm::Value {
     let c_name = CString::new(name).unwrap();
     let llglobal: &'ll llvm::Value = llvm::add_global(cx.llmod, cx.val_ty(initializer), &c_name);
     llvm::set_global_constant(llglobal, true);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:737:
     llglobal
 }
 
-
-
 fn gen_define_handling<'ll>(cx: &'ll SimpleCx<'_>, offload_entry_ty: &'ll llvm::Type, num: i64) {
     // We add a pair of sizes and maptypes per offloadable function.
     // @.offload_maptypes = private unnamed_addr constant [4 x i64] [i64 800, i64 544, i64 547, i64 544]
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:745:
-    let o_sizes = add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![8u64,0,16,0]);
-    let o_types = add_priv_unnamed_arr(&cx, &format!(".offload_maptypes.{num}"), &vec![800u64, 544, 547, 544]);
+    let o_sizes =
+        add_priv_unnamed_arr(&cx, &format!(".offload_sizes.{num}"), &vec![8u64, 0, 16, 0]);
+    let o_types = add_priv_unnamed_arr(
+        &cx,
+        &format!(".offload_maptypes.{num}"),
+        &vec![800u64, 544, 547, 544],
+    );
     // TODO: We should add another pair per call to offloadable functions
     // @.offload_sizes.5 = private unnamed_addr constant [2 x i64] [i64 16384, i64 16384]
     // @.offload_maptypes.6 = private unnamed_addr constant [2 x i64] [i64 1, i64 3]
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:767:
     let c_section_name = CString::new(".llvm.rodata.offloading").unwrap();
     llvm::set_section(llglobal, &c_section_name);
 
-
     // Not actively used yet, for calling real kernels
     let name = format!(".offloading.entry.kernel_{num}");
     let ci64_0 = cx.get_const_i64(0);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:774:
     let ci16_1 = cx.get_const_i16(1);
-    let elems: Vec<&llvm::Value> = vec![ci64_0, ci16_1, ci16_1, cx.get_const_i32(0), region_id, llglobal, ci64_0, ci64_0, cx.const_null(cx.type_ptr())];
+    let elems: Vec<&llvm::Value> = vec![
+        ci64_0,
+        ci16_1,
+        ci16_1,
+        cx.get_const_i32(0),
+        region_id,
+        llglobal,
+        ci64_0,
+        ci64_0,
+        cx.const_null(cx.type_ptr()),
+    ];
 
     let initializer = crate::common::named_struct(offload_entry_ty, &elems);
     let c_name = CString::new(name).unwrap();
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:788:
     // clang
     // @.offloading.entry.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }, section "omp_offloading_entries", align 1
 
-
     //
     // 1. @.offload_sizes.{num} = private unnamed_addr constant [4 x i64] [i64 8, i64 0, i64 16, i64 0]
     // 2. @.offload_maptypes
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:797:
     // 5. @.offloading.entry.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7 = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @.__omp_offloading_86fafab6_c40006a1__Z3fooPSt7complexIdES1_S0_m_l7.region_id, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }, section "omp_offloading_entries", align 1
 }
 
-fn gen_call_handling<'ll>(cx: &'ll SimpleCx<'_>, s_ident_t: &'ll llvm::Value, begin: &'ll llvm::Value, update: &'ll llvm::Value, end: &'ll llvm::Value, fn_ty: &'ll llvm::Type) {
-
+fn gen_call_handling<'ll>(
+    cx: &'ll SimpleCx<'_>,
+    s_ident_t: &'ll llvm::Value,
+    begin: &'ll llvm::Value,
+    update: &'ll llvm::Value,
+    end: &'ll llvm::Value,
+    fn_ty: &'ll llvm::Type,
+) {
     let main_fn = cx.get_function("main");
     if let Some(main_fn) = main_fn {
-        let kernel_name = "kernel_1";//name.as_c_char_ptr(), name.len)
-        let call = unsafe {llvm::LLVMRustGetFunctionCall(main_fn, kernel_name.as_c_char_ptr(), kernel_name.len())};
+        let kernel_name = "kernel_1"; //name.as_c_char_ptr(), name.len)
+        let call = unsafe {
+            llvm::LLVMRustGetFunctionCall(main_fn, kernel_name.as_c_char_ptr(), kernel_name.len())
+        };
         let kernel_call = if call.is_some() {
             dbg!("found kernel call");
             call.unwrap()
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:809:
         } else {
             return;
         };
-        let kernel_call_bb = unsafe {llvm::LLVMGetInstructionParent(kernel_call)};
+        let kernel_call_bb = unsafe { llvm::LLVMGetInstructionParent(kernel_call) };
         let mut builder = SBuilder::build(cx, kernel_call_bb);
-        unsafe {llvm::LLVMRustPositionBefore(builder.llbuilder, kernel_call)};
+        unsafe { llvm::LLVMRustPositionBefore(builder.llbuilder, kernel_call) };
         dbg!("positioned builder, ready");
 
         let nullptr = cx.const_null(cx.type_ptr());
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:818:
-        let args = vec![s_ident_t, cx.get_const_i64(u64::MAX), cx.get_const_i32(3), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr];
+        let args = vec![
+            s_ident_t,
+            cx.get_const_i64(u64::MAX),
+            cx.get_const_i32(3),
+            nullptr,
+            nullptr,
+            nullptr,
+            nullptr,
+            nullptr,
+            nullptr,
+        ];
         dbg!(&fn_ty);
         dbg!(&begin);
         dbg!(&args);
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:869:
     // We then run the llvm_optimize function a second time, to optimize the code which we generated
     // in the enzyme differentiation pass.
     let enable_ad = config.autodiff.contains(&config::AutoDiff::Enable);
-    let enable_gpu = true;//config.offload.contains(&config::Offload::Enable);
+    let enable_gpu = true; //config.offload.contains(&config::Offload::Enable);
     let stage = if thin {
         write::AutodiffStage::PreAD
     } else {
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:891:
         let cx =
             SimpleCx::new(module.module_llvm.llmod(), &module.module_llvm.llcx, cgcx.pointer_size);
         if cx.get_function("gen_tgt_offload").is_some() {
-
             let (offload_entry_ty, at_one, foo, bar, baz, fn_ty) = gen_globals(&cx);
 
             dbg!("created struct");
Diff in /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:1178:
                 .expect("Invalid ThinLTO module key");
                 (module_name_to_str(name).to_string(), key)
             })
-        .collect();
+            .collect();
         Self { keys }
     }
 }
Diff in /checkout/compiler/rustc_session/src/config.rs:3068:
     };
 
     use super::{
-        AutoDiff, Offload, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
+        AutoDiff, BranchProtection, CFGuard, CFProtection, CollapseMacroDebuginfo, CoverageOptions,
         CrateType, DebugInfo, DebugInfoCompression, ErrorOutputType, FmtDebug, FunctionReturn,
         InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
-        LtoCli, MirStripDebugInfo, NextSolverConfig, OomStrategy, OptLevel, OutFileName,
+        LtoCli, MirStripDebugInfo, NextSolverConfig, Offload, OomStrategy, OptLevel, OutFileName,
         OutputType, OutputTypes, PatchableFunctionEntry, Polonius, RemapPathScopeComponents,
         ResolveDocLinks, SourceFileHashAlgorithm, SplitDwarfKind, SwitchWithOptPath,
         SymbolManglingVersion, WasiExecModel,
fmt: checked 6051 files
Build completed unsuccessfully in 0:00:45
  local time: Mon Jun  9 18:53:00 UTC 2025
  network time: Mon, 09 Jun 2025 18:53:00 GMT
##[error]Process completed with exit code 1.

rust-log-analyzer avatar Jun 09 '25 18:06 rust-log-analyzer

@oli-obk Featurewise, I am almost done. I'll add a few more lines to describe the layout of Rust types to the offload library, but in this PR I only intend to support one type or two (maybe array's, raw pointer, or slices). I might even hardcode the length in the very first approach. In a follow-up PR I'll do some proper type parsing on a higher level, similar to what I did in the past with Rust TypeTrees. This work is much simpler and more reliable though, since offload doesn't care what type something has, just how many bytes it is large, and hence need to be moved to/from the GPU.

I was able to just move a few of the builder methods I needed to the generic builder. However, there are also around 7 that I had to duplicate. I guess at some point I'll need to do the proper work of enabling the trait implementations for both builders :/ Once I have everything working, I'll clean it up and add some tests and docs.

ZuseZ4 avatar Jun 10 '25 03:06 ZuseZ4

Not fully ready yet, I apparently missed yet another global to initialize the offload runtime. But at least it compiles successfully to a binary if I emit the IR from Rust, and then use clang for the rest. I'll add the global today, then I should be done and will clean it up

ZuseZ4 avatar Jun 12 '25 14:06 ZuseZ4

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
fmt: checked 6071 files
tidy check
Running eslint on rustdoc JS files
tidy: Skipping binary file check, read-only filesystem
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:672: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:73: TODO is used for tasks that should be done before merging a PR; If you want to leave a message in the codebase use FIXME
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:194: TODO is used for tasks that should be done before merging a PR; If you want to leave a message in the codebase use FIXME
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:231: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:241: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:246: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:326: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:565: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:575: `dbg!` macro is intended as a debugging tool. It should not be in version control.
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'venv'
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'virtualenv'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (25.1.1)
linting python files
All checks passed!
checking python file formatting
28 files already formatted
checking C++ file formatting
some tidy checks failed
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:01:18
  local time: Tue Jun 17 04:09:22 UTC 2025
  network time: Tue, 17 Jun 2025 04:09:22 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar Jun 17 '25 04:06 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
fmt: checked 6072 files
tidy check
Running eslint on rustdoc JS files
tidy: Skipping binary file check, read-only filesystem
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:672: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_device.rs:88: TODO is used for tasks that should be done before merging a PR; If you want to leave a message in the codebase use FIXME
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:121: TODO is used for tasks that should be done before merging a PR; If you want to leave a message in the codebase use FIXME
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:158: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:168: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:174: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:254: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:461: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:471: `dbg!` macro is intended as a debugging tool. It should not be in version control.
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'venv'
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'virtualenv'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (25.1.1)
linting python files
All checks passed!
checking python file formatting
28 files already formatted
checking C++ file formatting
some tidy checks failed
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:01:21
  local time: Tue Jun 17 21:41:37 UTC 2025
  network time: Tue, 17 Jun 2025 21:41:37 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar Jun 17 '25 21:06 rust-log-analyzer

:umbrella: The latest upstream changes (presumably #142644) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 18 '25 04:06 bors

Jay, turns out the only issue in my test binary was a bug in LLVM, which was already fixed upstream in https://github.com/llvm/llvm-project/pull/143638. Once rustc syncs the llvm submodule again (in a week or so), we should get the fix. This does not affect the llvm-ir we generate with rustc, it just affects how clang compiles the llvm-ir from rustc to a binary. Therefore we don't have to wait for it. I'll add an llvm-ir test to make sure we generate the right things and clean it up a bit more.

ZuseZ4 avatar Jun 18 '25 21:06 ZuseZ4

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
fmt: checked 6073 files
tidy check
Running eslint on rustdoc JS files
tidy: Skipping binary file check, read-only filesystem
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:672: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:121: TODO is used for tasks that should be done before merging a PR; If you want to leave a message in the codebase use FIXME
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:157: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:167: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:250: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:457: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:467: `dbg!` macro is intended as a debugging tool. It should not be in version control.
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'venv'
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'virtualenv'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (25.1.1)
linting python files
All checks passed!
checking python file formatting
28 files already formatted
checking C++ file formatting
some tidy checks failed
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:01:20
  local time: Wed Jun 18 22:01:57 UTC 2025
  network time: Wed, 18 Jun 2025 22:01:57 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar Jun 18 '25 22:06 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
fmt: checked 6074 files
tidy check
Running eslint on rustdoc JS files
tidy: Skipping binary file check, read-only filesystem
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/back/lto.rs:672: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:121: TODO is used for tasks that should be done before merging a PR; If you want to leave a message in the codebase use FIXME
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:157: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:167: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:250: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:457: `dbg!` macro is intended as a debugging tool. It should not be in version control.
##[error]tidy error: /checkout/compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:467: `dbg!` macro is intended as a debugging tool. It should not be in version control.
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'venv'
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'virtualenv'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (25.1.1)
linting python files
All checks passed!
checking python file formatting
28 files already formatted
checking C++ file formatting
some tidy checks failed
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:01:25
  local time: Wed Jun 18 23:54:41 UTC 2025
  network time: Wed, 18 Jun 2025 23:54:41 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar Jun 18 '25 23:06 rust-log-analyzer

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

rustbot avatar Jun 19 '25 00:06 rustbot

ok, I think I'm mostly done. Do you have any suggestions? I don't want to add any actual run tests, as these would require a working clang based on the same commit.

ZuseZ4 avatar Jun 24 '25 22:06 ZuseZ4

:umbrella: The latest upstream changes (presumably #143026) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 26 '25 03:06 bors

I don't want to add any actual run tests, as these would require a working clang based on the same commit.

why is clang necessary for this?

oli-obk avatar Jul 01 '25 16:07 oli-obk

I don't want to add any actual run tests, as these would require a working clang based on the same commit.

why is clang necessary for this?

This time I started with dev guide docs! https://rustc-dev-guide.rust-lang.org/offload/installation.html#usage Pretty much, to create and run the binary we have to implement multiple steps, and this is only the first step out of maybe 5. Clang has the full pipeline implemented, so I just rely on it for the following steps, until we also implemented more in rustc.

ZuseZ4 avatar Jul 01 '25 23:07 ZuseZ4

I... don't know if I can review this properly. I can review it from the "does this fit into how I want the llvm backend to look" side, but what it actually does just looks random to me.

Thanks! And no worries, I'm discussing the offloading design with @jdoerfert and @kevinsala. The memory transfer is pretty straightforward and not that interesting. The only question was how many layers of abstraction we wanted, but we made a decision which should be fine, we could always re-evaluate it later. For the Kernel launches PR I'll ask them to also review the code, but they aren't rust devs, so your reviews on the rustc side are definetly appreciated!

ZuseZ4 avatar Jul 01 '25 23:07 ZuseZ4

@oli-obk I cleaned up the code a bit more and addressed your feedback. This reduced the number of values which I pass around between functions by a lot. Lmk if it it looks good to you or if you have more thoughts, afterwards I'll clean up the history (and rebase).

ZuseZ4 avatar Jul 08 '25 23:07 ZuseZ4

fwiw, running this directly through rustc or as part of the rust test suite works. Calling cargo fails due to triggering an llvm assertion, because cargo adds --emit=link. Everything else works. cc @kevinsala

Can't get register for value!
UNREACHABLE executed at `somepath/rust/src/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:1967!

.rustup/toolchains/offload/bin/rustc --crate-name r --edition=2024 src/lib.rs --crate-type cdylib -C opt-level=3 -C lto=fat --out-dir /somepath/drehwald/prog/offload/r/target/release/deps -C strip=debuginfo -O -C lto=fat -C panic=abort -Z offload=Enable --emit=llvm-ir --emit=dep-info,link

Which is fair, I'm still using clang/lld as the driver and linker. In the next PR I'll start using rustc for more and fixing linking as part of it.

Also looking forward to https://github.com/rust-lang/rust/pull/143684/files, which will fix some offload logic, but isn't blocking. https://github.com/nikic/llvm-project/blob/c5e8134bf939bd5fcf48faeb4efd0d18c4721b4a/offload/libomptarget/PluginManager.cpp#L289

ZuseZ4 avatar Jul 09 '25 23:07 ZuseZ4

I removed the cfg gate, happy to not have it rely on Enzyme.

ZuseZ4 avatar Jul 10 '25 00:07 ZuseZ4

I feel like the large number of helper functions makes it a bit hard to follow. Once we have the other two modules (gpu_wrapper, gpu_device) next to the gpu_offload module, I'll probably extract most of the small ones into a shared gpu_helper module.

ZuseZ4 avatar Jul 10 '25 20:07 ZuseZ4

Yea, without real deduplication they don't help too much. Sad. Maybe a closure would've worked.

r=me with a rebase and squash. Feel free to remove the latest helpers if you want

oli-obk avatar Jul 11 '25 06:07 oli-obk