Skip to content

Commit f32d2da

Browse files
committed
Update rustc to handle mangled functions in offload_args, adjust test
1 parent cf856cc commit f32d2da

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

compiler/rustc_monomorphize/src/collector/autodiff.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ pub(crate) fn collect_autodiff_fn<'tcx>(
1515
intrinsic: IntrinsicDef,
1616
output: &mut MonoItems<'tcx>,
1717
) {
18-
if intrinsic.name != rustc_span::sym::autodiff {
18+
if intrinsic.name != rustc_span::sym::autodiff
19+
&& intrinsic.name != rustc_span::sym::offload
20+
&& intrinsic.name != rustc_span::sym::offload_args
21+
{
1922
return;
2023
};
2124

tests/codegen-llvm/gpu_offload/offload_args.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
// neither want to deal with the creation or destruction of handles that those require since it's
88
// just noise. We do however test that we can combine host pointer (like alpha, beta) with device
99
// pointers (A, x, y). We also test std support while already at it.
10-
// FIXME(offload): We should be able remove the no_mangle from the wrapper if we mark it as used.
1110

1211
#![allow(internal_features, non_camel_case_types, non_snake_case)]
1312
#![feature(rustc_attrs)]
@@ -24,7 +23,8 @@ fn main() {
2423
// CHECK-NEXT: [[A:%.*]] = call ptr @omp_get_mapped_ptr(ptr nonnull %A, i32 0)
2524
// CHECK-NEXT: [[X:%.*]] = call ptr @omp_get_mapped_ptr(ptr nonnull %x, i32 0)
2625
// CHECK-NEXT: [[Y:%.*]] = call ptr @omp_get_mapped_ptr(ptr nonnull %y, i32 0)
27-
// CHECK-NEXT: call {{.*}}void @rocblas_sgemv_wrapper(ptr [[A]], ptr [[X]], ptr [[Y]])
26+
// CHECK-NEXT: ; call offload_args::rocblas_sgemv_wrapper
27+
// CHECK-NEXT: call {{.*}}void {{@_RNv.*rocblas_sgemv_wrapper.*}}(ptr [[A]], ptr [[X]], ptr [[Y]])
2828
// CHECK-NEXT: call void @__tgt_target_data_end_mapper(
2929
}
3030
println!("{:?}", y);
@@ -45,7 +45,6 @@ unsafe extern "C" {
4545
) -> i32;
4646
}
4747

48-
#[unsafe(no_mangle)]
4948
#[inline(never)]
5049
pub fn rocblas_sgemv_wrapper(A: &mut [f32; 6], x: &mut [f32; 3], y: &mut [f32; 2]) -> () {
5150
let m: i32 = 2;
@@ -57,7 +56,8 @@ pub fn rocblas_sgemv_wrapper(A: &mut [f32; 6], x: &mut [f32; 3], y: &mut [f32; 2
5756
let alpha: f32 = 1.0;
5857
let beta: f32 = 1.0;
5958

60-
// CHECK-LABEL: define {{.*}}void @rocblas_sgemv_wrapper(ptr{{.*}} %A, ptr{{.*}} %x, ptr{{.*}} %y)
59+
// CHECK-LABEL: ; offload_args::rocblas_sgemv_wrapper
60+
// CHECK: define {{.*}}void {{.*}}rocblas_sgemv_wrapper{{.*}}(ptr{{.*}} %A, ptr{{.*}} %x, ptr{{.*}} %y)
6161
// CHECK-DAG: %alpha = alloca [4 x i8]
6262
// CHECK-DAG: %beta = alloca [4 x i8]
6363
// CHECK-DAG: store float 1.000000e+00, ptr %alpha

0 commit comments

Comments
 (0)