Skip to content

Commit 43d1334

Browse files
committed
Fix: use core::arch::asm when building cuda target
1 parent 9d7c265 commit 43d1334

File tree

9 files changed

+18
-7
lines changed

9 files changed

+18
-7
lines changed

crates/cuda_std/src/warp.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
66
use crate::gpu_only;
77
use half::{bf16, f16};
8+
#[cfg(target_os = "cuda")]
9+
use core::arch::asm;
810

911
/// Synchronizes all of the threads inside of this warp according to `mask`.
1012
///

crates/optix_device/src/hit.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use cuda_std::gpu_only;
22
use glam::Vec3;
3-
3+
#[cfg(target_os = "cuda")]
4+
use core::arch::asm;
45
/// The type of primitive that a ray hit.
56
#[repr(u32)]
67
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]

crates/optix_device/src/intersect.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use cuda_std::gpu_only;
22
use paste::paste;
33
use seq_macro::seq;
4+
#[cfg(target_os = "cuda")]
5+
use core::arch::asm;
46

57
#[gpu_only]
68
pub fn primitive_index() -> u32 {

crates/optix_device/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
#![cfg_attr(
2-
target_arch = "nvptx64",
3-
no_std,
4-
feature(asm_experimental_arch),
5-
register_attr(nvvm_internal)
6-
)]
1+
#[cfg(target_os = "cuda")]
2+
use core::arch::asm;
73

84
extern crate alloc;
95

crates/optix_device/src/misc.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
use cuda_std::gpu_only;
2+
#[cfg(target_os = "cuda")]
3+
use core::arch::asm;
24

35
/// Retrieves the data past the SBT header for this particular program
46
///

crates/optix_device/src/payload.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use crate::sys;
22
use cuda_std::gpu_only;
3+
#[cfg(target_os = "cuda")]
4+
use core::arch::asm;
35

46
/// Overrides the payload for the given register to a value.
57
///

crates/optix_device/src/ray.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use crate::trace::*;
22
use cuda_std::gpu_only;
33
use glam::Vec3;
4+
#[cfg(target_os = "cuda")]
5+
use core::arch::asm;
46

57
/// Returns the ray origin that was passed into [`trace`] in world-space.
68
///

crates/optix_device/src/sys.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use crate::trace::{RayFlags, TraversableHandle};
44
use cuda_std::gpu_only;
55
use glam::Vec3;
66
use paste::paste;
7+
#[cfg(target_os = "cuda")]
8+
use core::arch::asm;
79

810
macro_rules! set_payload {
911
($($number:literal),*) => {

crates/optix_device/src/transform.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// use std::hint::unreachable_unchecked;
22
use cuda_std::gpu_only;
33
use glam::{Vec3, Vec4};
4+
#[cfg(target_os = "cuda")]
5+
use core::arch::asm;
46

57
use crate::{intersection::ray_time, trace::TraversableHandle};
68

0 commit comments

Comments
 (0)