Skip to content

Commit be0d1fb

Browse files
authored
FIX: Remove nvptx target architecture conditions. (#145)
32-bit support was removed in ef4fcc8. Updates attributes to match. Fixes numerous warnings when compiling with newer nightly.
1 parent ab4af16 commit be0d1fb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

crates/cuda_std/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ pub mod prelude {
7676
};
7777
}
7878

79-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
79+
#[cfg(target_arch = "nvptx64")]
8080
#[alloc_error_handler]
8181
fn alloc_handler(layout: core::alloc::Layout) -> ! {
8282
core::panic!("Memory allocation of {} bytes failed", layout.size());
8383
}
8484

8585
// FIXME(RDambrosio016): For some very odd reason, this function causes an InvalidAddress error when called,
8686
// despite it having no reason for doing that. It needs more debugging to see what is causing it exactly. For now we just trap.
87-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
87+
#[cfg(target_arch = "nvptx64")]
8888
#[panic_handler]
8989
fn panic(_info: &core::panic::PanicInfo) -> ! {
9090
// use crate::prelude::*;

crates/cuda_std_macros/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn kernel(input: proc_macro::TokenStream, item: proc_macro::TokenStream) ->
2727
let mut item = parse_macro_input!(item as ItemFn);
2828
let no_mangle = parse_quote!(#[no_mangle]);
2929
item.attrs.push(no_mangle);
30-
let internal = parse_quote!(#[cfg_attr(any(target_arch="nvptx", target_arch="nvptx64"), nvvm_internal(kernel(#input)))]);
30+
let internal = parse_quote!(#[cfg_attr(target_arch="nvptx64", nvvm_internal(kernel(#input)))]);
3131
item.attrs.push(internal);
3232

3333
// used to guarantee some things about how params are passed in the codegen.
@@ -170,13 +170,13 @@ pub fn gpu_only(_attr: proc_macro::TokenStream, item: proc_macro::TokenStream) -
170170
};
171171

172172
let output = quote::quote! {
173-
#[cfg(not(any(target_arch="nvptx", target_arch="nvptx64")))]
173+
#[cfg(not(target_arch="nvptx64"))]
174174
#[allow(unused_variables)]
175175
#(#cloned_attrs)* #vis #sig_cpu {
176176
unimplemented!(concat!("`", stringify!(#fn_name), "` can only be used on the GPU with rustc_codegen_nvvm"))
177177
}
178178

179-
#[cfg(any(target_arch="nvptx", target_arch="nvptx64"))]
179+
#[cfg(target_arch="nvptx64")]
180180
#(#attrs)* #vis #sig {
181181
#block
182182
}

0 commit comments

Comments
 (0)