Skip to content

Commit 0044257

Browse files
authored
Merge branch 'Rust-GPU:main' into main
2 parents 7e3c5d9 + 54f476c commit 0044257

File tree

51 files changed

+150
-223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+150
-223
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ on:
77
push:
88
paths-ignore:
99
- '**.md'
10-
branches:
11-
- master
1210

1311
env:
1412
RUST_LOG: info
@@ -33,7 +31,7 @@ jobs:
3331
uses: actions/checkout@v2
3432

3533
- name: Install CUDA
36-
uses: Jimver/cuda-toolkit@v0.2.4
34+
uses: Jimver/cuda-toolkit@v0.2.21
3735
id: cuda-toolkit
3836
with:
3937
cuda: '11.2.2'
@@ -74,4 +72,4 @@ jobs:
7472
- name: Check documentation
7573
env:
7674
RUSTDOCFLAGS: -Dwarnings
77-
run: cargo doc --workspace --all-features --document-private-items --no-deps --exclude "optix" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*"
75+
run: cargo doc --workspace --all-features --document-private-items --no-deps --exclude "optix" --exclude "path_tracer" --exclude "denoiser" --exclude "add" --exclude "ex*"

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
[workspace]
2+
3+
resolver = "2"
4+
25
members = [
36
"crates/*",
47
"crates/optix/examples/ex*",

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ Other projects related to using Rust on the GPU:
8282
- 2020: [rlsl](https://github.com/MaikKlein/rlsl) Experimental Rust -> SPIR-V compiler (predecessor to rust-gpu)
8383
- 2020: [rust-gpu](https://github.com/Rust-GPU/rust-gpu) `rustc` compiler backend to compile Rust to SPIR-V for use in shaders, similar mechanism as our project.
8484

85+
## Usage
86+
```bash
87+
## setup your environment like:
88+
### export OPTIX_ROOT=/opt/NVIDIA-OptiX-SDK-9.0.0-linux64-x86_64
89+
### export OPTIX_ROOT_DIR=/opt/NVIDIA-OptiX-SDK-9.0.0-linux64-x86_64
90+
91+
## build proj
92+
cargo build
93+
```
94+
8595
## License
8696

8797
Licensed under either of

crates/blastoff/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ authors = ["Riccardo D'Ambrosio <rdambrosio016@gmail.com>"]
66
repository = "https://github.com/Rust-GPU/Rust-CUDA"
77

88
[dependencies]
9-
bitflags = "1.3.2"
9+
bitflags = "2.8"
1010
cublas_sys = { version = "0.1", path = "../cublas_sys" }
1111
cust = { version = "0.3", path = "../cust", features = ["impl_num_complex"] }
12-
num-complex = "0.4.0"
13-
half = { version = "1.8.0", optional = true }
12+
num-complex = "0.4.6"
13+
half = { version = "2.4.1", optional = true }
1414

1515
[package.metadata.docs.rs]
1616
rustdoc-args = ["--html-in-header", "katex-header.html", "--cfg", "docsrs"]

crates/cuda_builder/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ readme = "../../README.md"
1111
[dependencies]
1212
rustc_codegen_nvvm = { version = "0.3", path = "../rustc_codegen_nvvm" }
1313
nvvm = { path = "../nvvm", version = "0.1" }
14-
serde = { version = "1.0.130", features = ["derive"] }
15-
serde_json = "1.0.68"
14+
serde = { version = "1.0.217", features = ["derive"] }
15+
serde_json = "1.0.138"
1616
find_cuda_helper = { version = "0.2", path = "../find_cuda_helper" }

crates/cuda_std/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ repository = "https://github.com/Rust-GPU/Rust-CUDA"
88
readme = "../../README.md"
99

1010
[dependencies]
11-
vek = { version = "0.15.1", default-features = false, features = ["libm"] }
11+
vek = { version = "0.17.1", default-features = false, features = ["libm"] }
1212
cuda_std_macros = { version = "0.2", path = "../cuda_std_macros" }
13-
half = "1.7.1"
14-
bitflags = "1.3.2"
15-
paste = "1.0.5"
13+
half = "2.4.1"
14+
bitflags = "2.8"
15+
paste = "1.0.15"

crates/cuda_std/src/float.rs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,25 @@ mod private {
5454

5555
macro_rules! f32_intrinsic {
5656
($self:expr, $func:ident($($param:expr),*)) => {{
57-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
57+
#[cfg(not(target_arch = "nvptx64"))]
5858
let val = $self.$func($($param),*);
59-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
59+
#[cfg(target_arch = "nvptx64")]
6060
let val = paste::paste! { unsafe { intrinsics::[<$func f>]($self, $($param),*)} };
6161
val
6262
}};
6363
}
6464

6565
macro_rules! f64_intrinsic {
6666
($self:expr, $func:ident($($param:expr),*)) => {{
67-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
67+
#[cfg(not(target_arch = "nvptx64"))]
6868
let val = $self.$func($($param),*);
69-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
69+
#[cfg(target_arch = "nvptx64")]
7070
let val = unsafe { intrinsics::$func($self, $($param),*)};
7171
val
7272
}};
7373
}
7474

75-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
75+
#[cfg(target_arch = "nvptx64")]
7676
use crate::intrinsics;
7777

7878
impl GpuFloat for f32 {
@@ -117,9 +117,9 @@ impl GpuFloat for f32 {
117117
#[must_use = "method returns a new number and does not mutate the original value"]
118118
#[inline]
119119
fn abs(self) -> f32 {
120-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
120+
#[cfg(not(target_arch = "nvptx64"))]
121121
let val = self.abs();
122-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
122+
#[cfg(target_arch = "nvptx64")]
123123
let val = { unsafe { intrinsics::fabsf(self) } };
124124
val
125125
}
@@ -161,9 +161,9 @@ impl GpuFloat for f32 {
161161
#[must_use = "method returns a new number and does not mutate the original value"]
162162
#[inline]
163163
fn mul_add(self, a: f32, b: f32) -> f32 {
164-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
164+
#[cfg(not(target_arch = "nvptx64"))]
165165
let val = self.mul_add(a, b);
166-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
166+
#[cfg(target_arch = "nvptx64")]
167167
let val = { unsafe { intrinsics::fmaf(self, a, b) } };
168168
val
169169
}
@@ -218,9 +218,9 @@ impl GpuFloat for f32 {
218218
#[must_use = "method returns a new number and does not mutate the original value"]
219219
#[inline]
220220
fn powf(self, n: f32) -> f32 {
221-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
221+
#[cfg(not(target_arch = "nvptx64"))]
222222
let val = self.powf(n);
223-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
223+
#[cfg(target_arch = "nvptx64")]
224224
let val = { unsafe { intrinsics::powf(self, n) } };
225225
val
226226
}
@@ -252,9 +252,9 @@ impl GpuFloat for f32 {
252252
#[must_use = "method returns a new number and does not mutate the original value"]
253253
#[inline]
254254
fn ln(self) -> f32 {
255-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
255+
#[cfg(not(target_arch = "nvptx64"))]
256256
let val = self.ln();
257-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
257+
#[cfg(target_arch = "nvptx64")]
258258
let val = { unsafe { intrinsics::logf(self) } };
259259
val
260260
}
@@ -362,9 +362,9 @@ impl GpuFloat for f32 {
362362
/// `(sin(x), cos(x))`.
363363
#[inline]
364364
fn sin_cos(self) -> (f32, f32) {
365-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
365+
#[cfg(not(target_arch = "nvptx64"))]
366366
let val = self.sin_cos();
367-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
367+
#[cfg(target_arch = "nvptx64")]
368368
let val = {
369369
let mut sptr = 0.0;
370370
let mut cptr = 0.0;
@@ -381,9 +381,9 @@ impl GpuFloat for f32 {
381381
#[must_use = "method returns a new number and does not mutate the original value"]
382382
#[inline]
383383
fn exp_m1(self) -> f32 {
384-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
384+
#[cfg(not(target_arch = "nvptx64"))]
385385
let val = self.exp_m1();
386-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
386+
#[cfg(target_arch = "nvptx64")]
387387
let val = { unsafe { intrinsics::expm1f(self) } };
388388
val
389389
}
@@ -393,9 +393,9 @@ impl GpuFloat for f32 {
393393
#[must_use = "method returns a new number and does not mutate the original value"]
394394
#[inline]
395395
fn ln_1p(self) -> f32 {
396-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
396+
#[cfg(not(target_arch = "nvptx64"))]
397397
let val = self.ln_1p();
398-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
398+
#[cfg(target_arch = "nvptx64")]
399399
let val = { unsafe { intrinsics::log1pf(self) } };
400400
val
401401
}
@@ -485,9 +485,9 @@ impl GpuFloat for f64 {
485485
#[must_use = "method returns a new number and does not mutate the original value"]
486486
#[inline]
487487
fn abs(self) -> f64 {
488-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
488+
#[cfg(not(target_arch = "nvptx64"))]
489489
let val = self.abs();
490-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
490+
#[cfg(target_arch = "nvptx64")]
491491
let val = { unsafe { intrinsics::fabs(self) } };
492492
val
493493
}
@@ -529,9 +529,9 @@ impl GpuFloat for f64 {
529529
#[must_use = "method returns a new number and does not mutate the original value"]
530530
#[inline]
531531
fn mul_add(self, a: f64, b: f64) -> f64 {
532-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
532+
#[cfg(not(target_arch = "nvptx64"))]
533533
let val = self.mul_add(a, b);
534-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
534+
#[cfg(target_arch = "nvptx64")]
535535
let val = { unsafe { intrinsics::fma(self, a, b) } };
536536
val
537537
}
@@ -586,9 +586,9 @@ impl GpuFloat for f64 {
586586
#[must_use = "method returns a new number and does not mutate the original value"]
587587
#[inline]
588588
fn powf(self, n: f64) -> f64 {
589-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
589+
#[cfg(not(target_arch = "nvptx64"))]
590590
let val = self.powf(n);
591-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
591+
#[cfg(target_arch = "nvptx64")]
592592
let val = { unsafe { intrinsics::pow(self, n) } };
593593
val
594594
}
@@ -620,9 +620,9 @@ impl GpuFloat for f64 {
620620
#[must_use = "method returns a new number and does not mutate the original value"]
621621
#[inline]
622622
fn ln(self) -> f64 {
623-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
623+
#[cfg(not(target_arch = "nvptx64"))]
624624
let val = self.ln();
625-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
625+
#[cfg(target_arch = "nvptx64")]
626626
let val = { unsafe { intrinsics::log(self) } };
627627
val
628628
}
@@ -730,9 +730,9 @@ impl GpuFloat for f64 {
730730
/// `(sin(x), cos(x))`.
731731
#[inline]
732732
fn sin_cos(self) -> (f64, f64) {
733-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
733+
#[cfg(not(target_arch = "nvptx64"))]
734734
let val = self.sin_cos();
735-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
735+
#[cfg(target_arch = "nvptx64")]
736736
let val = {
737737
let mut sptr = 0.0;
738738
let mut cptr = 0.0;
@@ -749,9 +749,9 @@ impl GpuFloat for f64 {
749749
#[must_use = "method returns a new number and does not mutate the original value"]
750750
#[inline]
751751
fn exp_m1(self) -> f64 {
752-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
752+
#[cfg(not(target_arch = "nvptx64"))]
753753
let val = self.exp_m1();
754-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
754+
#[cfg(target_arch = "nvptx64")]
755755
let val = { unsafe { intrinsics::expm1(self) } };
756756
val
757757
}
@@ -761,9 +761,9 @@ impl GpuFloat for f64 {
761761
#[must_use = "method returns a new number and does not mutate the original value"]
762762
#[inline]
763763
fn ln_1p(self) -> f64 {
764-
#[cfg(not(any(target_arch = "nvptx", target_arch = "nvptx64")))]
764+
#[cfg(not(target_arch = "nvptx64"))]
765765
let val = self.ln_1p();
766-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
766+
#[cfg(target_arch = "nvptx64")]
767767
let val = { unsafe { intrinsics::log1p(self) } };
768768
val
769769
}

crates/cuda_std/src/mem.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//! Support for allocating memory and using `alloc` using CUDA memory allocation system-calls.
22
33
use crate::gpu_only;
4-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
4+
#[cfg(target_arch = "nvptx64")]
55
use alloc::alloc::*;
6-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
6+
#[cfg(target_arch = "nvptx64")]
77
use core::ffi::c_void;
88

9-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
9+
#[cfg(target_arch = "nvptx64")]
1010
extern "C" {
1111
// implicitly defined by cuda.
1212
pub fn malloc(size: usize) -> *mut c_void;
@@ -16,7 +16,7 @@ extern "C" {
1616

1717
pub struct CUDAAllocator;
1818

19-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
19+
#[cfg(target_arch = "nvptx64")]
2020
unsafe impl GlobalAlloc for CUDAAllocator {
2121
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
2222
malloc(layout.size()) as *mut u8
@@ -26,7 +26,7 @@ unsafe impl GlobalAlloc for CUDAAllocator {
2626
}
2727
}
2828

29-
#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
29+
#[cfg(target_arch = "nvptx64")]
3030
#[global_allocator]
3131
pub static GLOBAL_ALLOCATOR: CUDAAllocator = CUDAAllocator;
3232

crates/cuda_std_macros/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ readme = "../../README.md"
1111
proc-macro = true
1212

1313
[dependencies]
14-
quote = "1.0.9"
15-
syn = { version = "1.0.75", features = ["full"] }
16-
proc-macro2 = "1"
14+
quote = "1.0.38"
15+
syn = { version = "2.0.96", features = ["full"] }
16+
proc-macro2 = "1.0.93"

crates/cuda_std_macros/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub fn gpu_only(_attr: proc_macro::TokenStream, item: proc_macro::TokenStream) -
156156

157157
let mut cloned_attrs = attrs.clone();
158158
cloned_attrs.retain(|a| {
159-
!a.path
159+
!a.path()
160160
.get_ident()
161161
.map(|x| *x == "nvvm_internal")
162162
.unwrap_or_default()
@@ -199,7 +199,7 @@ pub fn externally_visible(
199199
let mut func = syn::parse_macro_input!(item as syn::ItemFn);
200200

201201
assert!(
202-
func.attrs.iter().any(|a| a.path.is_ident("no_mangle")),
202+
func.attrs.iter().any(|a| a.path().is_ident("no_mangle")),
203203
"#[externally_visible] function should also be #[no_mangle]"
204204
);
205205

0 commit comments

Comments
 (0)