From b9354633f05d0ea877a2fae93e28b7654fe334e7 Mon Sep 17 00:00:00 2001 From: trigpolynom Date: Sat, 15 Mar 2025 00:41:52 -0400 Subject: [PATCH 01/12] fixing --- crates/find_cuda_helper/src/lib.rs | 50 +++++++++-------- .../examples/rust/ex04_mesh_gpu/src/lib.rs | 4 ++ crates/optix/optix_wrapper.rs | 56 +++++++++---------- crates/optix_device/src/lib.rs | 1 - crates/rustc_codegen_nvvm/src/nvvm.rs | 8 ++- examples/cuda/gpu/path_tracer_gpu/Cargo.toml | 2 +- examples/cuda/gpu/path_tracer_gpu/src/lib.rs | 2 +- .../cuda/gpu/path_tracer_gpu/src/optix.rs | 1 - 8 files changed, 68 insertions(+), 56 deletions(-) diff --git a/crates/find_cuda_helper/src/lib.rs b/crates/find_cuda_helper/src/lib.rs index ed3b2f46..c0e6a4e2 100644 --- a/crates/find_cuda_helper/src/lib.rs +++ b/crates/find_cuda_helper/src/lib.rs @@ -29,30 +29,34 @@ fn is_cuda_root_path>(path: P) -> bool { path.as_ref().join("include").join("cuda.h").is_file() } -pub fn find_cuda_root() -> Option { - // search through the common environment variables first - for path in ["CUDA_PATH", "CUDA_ROOT", "CUDA_TOOLKIT_ROOT_DIR"] - .iter() - .filter_map(|name| std::env::var(*name).ok()) - { - if is_cuda_root_path(&path) { - return Some(path.into()); - } - } - - // If it wasn't specified by env var, try the default installation paths - #[cfg(not(target_os = "windows"))] - let default_paths = ["/usr/lib/cuda", "/usr/local/cuda", "/opt/cuda"]; - #[cfg(target_os = "windows")] - let default_paths = ["C:/CUDA"]; // TODO (AL): what's the actual path here? +// pub fn find_cuda_root() -> Option { +// // search through the common environment variables first +// for path in ["CUDA_PATH", "CUDA_ROOT", "CUDA_TOOLKIT_ROOT_DIR"] +// .iter() +// .filter_map(|name| std::env::var(*name).ok()) +// { +// if is_cuda_root_path(&path) { +// return Some(path.into()); +// } +// } + +// // If it wasn't specified by env var, try the default installation paths +// #[cfg(not(target_os = "windows"))] +// let default_paths = ["/usr/lib/cuda", "/usr/local/cuda", "/opt/cuda"]; +// #[cfg(target_os = "windows")] +// let default_paths = ["C:/CUDA"]; // TODO (AL): what's the actual path here? + +// for path in default_paths { +// if is_cuda_root_path(path) { +// return Some(path.into()); +// } +// } + +// None +// } - for path in default_paths { - if is_cuda_root_path(path) { - return Some(path.into()); - } - } - - None +pub fn find_cuda_root() -> Option { + Some(PathBuf::from("/usr/lib/cuda")) } #[cfg(target_os = "windows")] diff --git a/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs b/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs index 4a82a710..71890d40 100644 --- a/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs +++ b/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs @@ -75,7 +75,11 @@ pub unsafe fn __miss__radiance() { } extern "C" { +<<<<<<< HEAD #[cfg_attr(target_os = "cuda", nvvm_internal::addrspace(4))] +======= + #[cfg_attr(target_os = "cuda", no_std)] +>>>>>>> d40b29f (fixing) static PARAMS: LaunchParams; } diff --git a/crates/optix/optix_wrapper.rs b/crates/optix/optix_wrapper.rs index 7f9740db..d43fe17d 100644 --- a/crates/optix/optix_wrapper.rs +++ b/crates/optix/optix_wrapper.rs @@ -188,9 +188,9 @@ impl OptixResult { } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct OptixResult(pub ::std::os::raw::c_int); +pub struct OptixResult(pub ::std::os::raw::c_uint); pub mod OptixDeviceProperty { - pub type Type = ::std::os::raw::c_int; + pub type Type = ::std::os::raw::c_uint; pub const OPTIX_DEVICE_PROPERTY_LIMIT_MAX_TRACE_DEPTH: Type = 8193; pub const OPTIX_DEVICE_PROPERTY_LIMIT_MAX_TRAVERSABLE_GRAPH_DEPTH: Type = 8194; pub const OPTIX_DEVICE_PROPERTY_LIMIT_MAX_PRIMITIVES_PER_GAS: Type = 8195; @@ -212,8 +212,8 @@ pub type OptixLogCallback = ::std::option::Option< pub const OptixDeviceContextValidationMode_OPTIX_DEVICE_CONTEXT_VALIDATION_MODE_OFF: OptixDeviceContextValidationMode = 0; pub const OptixDeviceContextValidationMode_OPTIX_DEVICE_CONTEXT_VALIDATION_MODE_ALL: - OptixDeviceContextValidationMode = -1; -pub type OptixDeviceContextValidationMode = ::std::os::raw::c_int; + OptixDeviceContextValidationMode = 4294967295; +pub type OptixDeviceContextValidationMode = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone, PartialEq)] pub struct OptixDeviceContextOptions { @@ -233,11 +233,11 @@ impl Default for OptixDeviceContextOptions { } pub const OptixHitKind_OPTIX_HIT_KIND_TRIANGLE_FRONT_FACE: OptixHitKind = 254; pub const OptixHitKind_OPTIX_HIT_KIND_TRIANGLE_BACK_FACE: OptixHitKind = 255; -pub type OptixHitKind = ::std::os::raw::c_int; +pub type OptixHitKind = ::std::os::raw::c_uint; pub const OptixIndicesFormat_OPTIX_INDICES_FORMAT_NONE: OptixIndicesFormat = 0; pub const OptixIndicesFormat_OPTIX_INDICES_FORMAT_UNSIGNED_SHORT3: OptixIndicesFormat = 8450; pub const OptixIndicesFormat_OPTIX_INDICES_FORMAT_UNSIGNED_INT3: OptixIndicesFormat = 8451; -pub type OptixIndicesFormat = ::std::os::raw::c_int; +pub type OptixIndicesFormat = ::std::os::raw::c_uint; pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_NONE: OptixVertexFormat = 0; pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_FLOAT3: OptixVertexFormat = 8481; pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_FLOAT2: OptixVertexFormat = 8482; @@ -245,10 +245,10 @@ pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_HALF3: OptixVertexFormat = 8483; pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_HALF2: OptixVertexFormat = 8484; pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_SNORM16_3: OptixVertexFormat = 8485; pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_SNORM16_2: OptixVertexFormat = 8486; -pub type OptixVertexFormat = ::std::os::raw::c_int; +pub type OptixVertexFormat = ::std::os::raw::c_uint; pub const OptixTransformFormat_OPTIX_TRANSFORM_FORMAT_NONE: OptixTransformFormat = 0; pub const OptixTransformFormat_OPTIX_TRANSFORM_FORMAT_MATRIX_FLOAT12: OptixTransformFormat = 8673; -pub type OptixTransformFormat = ::std::os::raw::c_int; +pub type OptixTransformFormat = ::std::os::raw::c_uint; #[repr(C)] pub struct OptixBuildInputTriangleArray { pub vertexBuffers: *const CUdeviceptr, @@ -283,7 +283,7 @@ pub const OptixPrimitiveType_OPTIX_PRIMITIVE_TYPE_ROUND_QUADRATIC_BSPLINE: Optix pub const OptixPrimitiveType_OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE: OptixPrimitiveType = 9474; pub const OptixPrimitiveType_OPTIX_PRIMITIVE_TYPE_ROUND_LINEAR: OptixPrimitiveType = 9475; pub const OptixPrimitiveType_OPTIX_PRIMITIVE_TYPE_TRIANGLE: OptixPrimitiveType = 9521; -pub type OptixPrimitiveType = ::std::os::raw::c_int; +pub type OptixPrimitiveType = ::std::os::raw::c_uint; pub const OptixPrimitiveTypeFlags_OPTIX_PRIMITIVE_TYPE_FLAGS_CUSTOM: OptixPrimitiveTypeFlags = 1; pub const OptixPrimitiveTypeFlags_OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_QUADRATIC_BSPLINE: OptixPrimitiveTypeFlags = 2; @@ -369,7 +369,7 @@ pub const OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_CUSTOM_PRIMITIVES: OptixBui pub const OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_INSTANCES: OptixBuildInputType = 8515; pub const OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_INSTANCE_POINTERS: OptixBuildInputType = 8516; pub const OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_CURVES: OptixBuildInputType = 8517; -pub type OptixBuildInputType = ::std::os::raw::c_int; +pub type OptixBuildInputType = ::std::os::raw::c_uint; #[repr(C)] pub struct OptixBuildInput__bindgen_ty_1 { pub triangleArray: __BindgenUnionField, @@ -395,7 +395,7 @@ pub const OptixInstanceFlags_OPTIX_INSTANCE_FLAG_FLIP_TRIANGLE_FACING: OptixInst pub const OptixInstanceFlags_OPTIX_INSTANCE_FLAG_DISABLE_ANYHIT: OptixInstanceFlags = 4; pub const OptixInstanceFlags_OPTIX_INSTANCE_FLAG_ENFORCE_ANYHIT: OptixInstanceFlags = 8; pub const OptixInstanceFlags_OPTIX_INSTANCE_FLAG_DISABLE_TRANSFORM: OptixInstanceFlags = 64; -pub type OptixInstanceFlags = ::std::os::raw::c_int; +pub type OptixInstanceFlags = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone, PartialEq)] pub struct OptixInstance { @@ -414,14 +414,14 @@ pub const OptixBuildFlags_OPTIX_BUILD_FLAG_PREFER_FAST_TRACE: OptixBuildFlags = pub const OptixBuildFlags_OPTIX_BUILD_FLAG_PREFER_FAST_BUILD: OptixBuildFlags = 8; pub const OptixBuildFlags_OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS: OptixBuildFlags = 16; pub const OptixBuildFlags_OPTIX_BUILD_FLAG_ALLOW_RANDOM_INSTANCE_ACCESS: OptixBuildFlags = 32; -pub type OptixBuildFlags = ::std::os::raw::c_int; +pub type OptixBuildFlags = ::std::os::raw::c_uint; pub const OptixBuildOperation_OPTIX_BUILD_OPERATION_BUILD: OptixBuildOperation = 8545; pub const OptixBuildOperation_OPTIX_BUILD_OPERATION_UPDATE: OptixBuildOperation = 8546; -pub type OptixBuildOperation = ::std::os::raw::c_int; +pub type OptixBuildOperation = ::std::os::raw::c_uint; pub const OptixMotionFlags_OPTIX_MOTION_FLAG_NONE: OptixMotionFlags = 0; pub const OptixMotionFlags_OPTIX_MOTION_FLAG_START_VANISH: OptixMotionFlags = 1; pub const OptixMotionFlags_OPTIX_MOTION_FLAG_END_VANISH: OptixMotionFlags = 2; -pub type OptixMotionFlags = ::std::os::raw::c_int; +pub type OptixMotionFlags = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone, PartialEq)] pub struct OptixMotionOptions { @@ -455,7 +455,7 @@ pub struct OptixAccelBufferSizes { } pub const OptixAccelPropertyType_OPTIX_PROPERTY_TYPE_COMPACTED_SIZE: OptixAccelPropertyType = 8577; pub const OptixAccelPropertyType_OPTIX_PROPERTY_TYPE_AABBS: OptixAccelPropertyType = 8578; -pub type OptixAccelPropertyType = ::std::os::raw::c_int; +pub type OptixAccelPropertyType = ::std::os::raw::c_uint; #[repr(C)] pub struct OptixAccelEmitDesc { pub result: CUdeviceptr, @@ -524,9 +524,9 @@ pub const OptixTraversableType_OPTIX_TRAVERSABLE_TYPE_MATRIX_MOTION_TRANSFORM: OptixTraversableType = 8642; pub const OptixTraversableType_OPTIX_TRAVERSABLE_TYPE_SRT_MOTION_TRANSFORM: OptixTraversableType = 8643; -pub type OptixTraversableType = ::std::os::raw::c_int; +pub type OptixTraversableType = ::std::os::raw::c_uint; pub mod OptixPixelFormat { - pub type Type = ::std::os::raw::c_int; + pub type Type = ::std::os::raw::c_uint; pub const OPTIX_PIXEL_FORMAT_HALF2: Type = 8711; pub const OPTIX_PIXEL_FORMAT_HALF3: Type = 8705; pub const OPTIX_PIXEL_FORMAT_HALF4: Type = 8706; @@ -555,7 +555,7 @@ impl Default for OptixImage2D { } } pub mod OptixDenoiserModelKind { - pub type Type = ::std::os::raw::c_int; + pub type Type = ::std::os::raw::c_uint; pub const OPTIX_DENOISER_MODEL_KIND_LDR: Type = 8994; pub const OPTIX_DENOISER_MODEL_KIND_HDR: Type = 8995; pub const OPTIX_DENOISER_MODEL_KIND_AOV: Type = 8996; @@ -630,21 +630,21 @@ pub const OptixRayFlags_OPTIX_RAY_FLAG_CULL_BACK_FACING_TRIANGLES: OptixRayFlags pub const OptixRayFlags_OPTIX_RAY_FLAG_CULL_FRONT_FACING_TRIANGLES: OptixRayFlags = 32; pub const OptixRayFlags_OPTIX_RAY_FLAG_CULL_DISABLED_ANYHIT: OptixRayFlags = 64; pub const OptixRayFlags_OPTIX_RAY_FLAG_CULL_ENFORCED_ANYHIT: OptixRayFlags = 128; -pub type OptixRayFlags = ::std::os::raw::c_int; +pub type OptixRayFlags = ::std::os::raw::c_uint; pub const OptixTransformType_OPTIX_TRANSFORM_TYPE_NONE: OptixTransformType = 0; pub const OptixTransformType_OPTIX_TRANSFORM_TYPE_STATIC_TRANSFORM: OptixTransformType = 1; pub const OptixTransformType_OPTIX_TRANSFORM_TYPE_MATRIX_MOTION_TRANSFORM: OptixTransformType = 2; pub const OptixTransformType_OPTIX_TRANSFORM_TYPE_SRT_MOTION_TRANSFORM: OptixTransformType = 3; pub const OptixTransformType_OPTIX_TRANSFORM_TYPE_INSTANCE: OptixTransformType = 4; -pub type OptixTransformType = ::std::os::raw::c_int; +pub type OptixTransformType = ::std::os::raw::c_uint; pub mod OptixTraversableGraphFlags { - pub type Type = ::std::os::raw::c_int; + pub type Type = ::std::os::raw::c_uint; pub const OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_ANY: Type = 0; pub const OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_GAS: Type = 1; pub const OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_LEVEL_INSTANCING: Type = 2; } pub mod OptixCompileOptimizationLevel { - pub type Type = ::std::os::raw::c_int; + pub type Type = ::std::os::raw::c_uint; pub const OPTIX_COMPILE_OPTIMIZATION_DEFAULT: Type = 0; pub const OPTIX_COMPILE_OPTIMIZATION_LEVEL_0: Type = 9024; pub const OPTIX_COMPILE_OPTIMIZATION_LEVEL_1: Type = 9025; @@ -652,7 +652,7 @@ pub mod OptixCompileOptimizationLevel { pub const OPTIX_COMPILE_OPTIMIZATION_LEVEL_3: Type = 9027; } pub mod OptixCompileDebugLevel { - pub type Type = ::std::os::raw::c_int; + pub type Type = ::std::os::raw::c_uint; pub const OPTIX_COMPILE_DEBUG_LEVEL_DEFAULT: Type = 0; pub const OPTIX_COMPILE_DEBUG_LEVEL_NONE: Type = 9040; pub const OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO: Type = 9041; @@ -694,7 +694,7 @@ impl Default for OptixModuleCompileOptions { } } pub mod OptixProgramGroupKind { - pub type Type = ::std::os::raw::c_int; + pub type Type = ::std::os::raw::c_uint; pub const OPTIX_PROGRAM_GROUP_KIND_RAYGEN: Type = 9249; pub const OPTIX_PROGRAM_GROUP_KIND_MISS: Type = 9250; pub const OPTIX_PROGRAM_GROUP_KIND_EXCEPTION: Type = 9251; @@ -702,7 +702,7 @@ pub mod OptixProgramGroupKind { pub const OPTIX_PROGRAM_GROUP_KIND_CALLABLES: Type = 9253; } pub const OptixProgramGroupFlags_OPTIX_PROGRAM_GROUP_FLAGS_NONE: OptixProgramGroupFlags = 0; -pub type OptixProgramGroupFlags = ::std::os::raw::c_int; +pub type OptixProgramGroupFlags = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone, PartialEq)] pub struct OptixProgramGroupSingleModule { @@ -826,7 +826,7 @@ pub const OptixExceptionCodes_OPTIX_EXCEPTION_CODE_UNSUPPORTED_DATA_ACCESS: Opti -32; pub type OptixExceptionCodes = ::std::os::raw::c_int; pub mod OptixExceptionFlags { - pub type Type = ::std::os::raw::c_int; + pub type Type = ::std::os::raw::c_uint; pub const OPTIX_EXCEPTION_FLAG_NONE: Type = 0; pub const OPTIX_EXCEPTION_FLAG_STACK_OVERFLOW: Type = 1; pub const OPTIX_EXCEPTION_FLAG_TRACE_DEPTH: Type = 2; @@ -906,7 +906,7 @@ pub struct OptixStackSizes { } pub const OptixQueryFunctionTableOptions_OPTIX_QUERY_FUNCTION_TABLE_OPTION_DUMMY: OptixQueryFunctionTableOptions = 0; -pub type OptixQueryFunctionTableOptions = ::std::os::raw::c_int; +pub type OptixQueryFunctionTableOptions = ::std::os::raw::c_uint; pub type OptixQueryFunctionTable_t = ::std::option::Option< unsafe extern "C" fn( abiId: ::std::os::raw::c_int, @@ -1543,7 +1543,7 @@ pub const OptixTransformByteAlignment: usize = 64; pub const OptixVersion: usize = 70300; pub const OptixBuildInputSize: usize = 1032; pub const OptixShaderBindingTableSize: usize = 64; -#[repr(i32)] +#[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum OptixGeometryFlags { None = 0, diff --git a/crates/optix_device/src/lib.rs b/crates/optix_device/src/lib.rs index 6471f0cc..76c0539f 100644 --- a/crates/optix_device/src/lib.rs +++ b/crates/optix_device/src/lib.rs @@ -17,7 +17,6 @@ pub mod util; use cuda_std::*; pub use glam; use glam::UVec3; - pub use misc::*; extern "C" { diff --git a/crates/rustc_codegen_nvvm/src/nvvm.rs b/crates/rustc_codegen_nvvm/src/nvvm.rs index eb90ee79..f49527ee 100644 --- a/crates/rustc_codegen_nvvm/src/nvvm.rs +++ b/crates/rustc_codegen_nvvm/src/nvvm.rs @@ -155,14 +155,20 @@ pub fn codegen_bitcode_modules( /// linked when building the nvvm program. pub fn find_libdevice() -> Option> { if let Some(base_path) = find_cuda_root() { - let libdevice_file = fs::read_dir(Path::new(&base_path).join("nvvm").join("libdevice")) + let libdevice_dir = Path::new(&base_path).join("nvvm").join("libdevice"); + println!("Checking libdevice directory: {:?}", libdevice_dir); + + let libdevice_file = fs::read_dir(&libdevice_dir) .ok()? .filter_map(Result::ok) .find(|f| f.path().extension() == Some(OsStr::new("bc")))? .path(); + println!("Found libdevice file: {:?}", libdevice_file); + fs::read(libdevice_file).ok() } else { + println!("CUDA root not found"); None } } diff --git a/examples/cuda/gpu/path_tracer_gpu/Cargo.toml b/examples/cuda/gpu/path_tracer_gpu/Cargo.toml index 46a07950..02cbc45f 100644 --- a/examples/cuda/gpu/path_tracer_gpu/Cargo.toml +++ b/examples/cuda/gpu/path_tracer_gpu/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" cuda_std = { version = "0.2", path = "../../../../crates/cuda_std" } enum_dispatch = "0.3.13" gpu_rand = { version = "0.1", path = "../../../../crates/gpu_rand" } -cust_core = { path = "../../../../crates/cust_core" } +cust_core = { path = "../../../../crates/cust_core", features=["vek"] } optix_device = { path = "../../../../crates/optix_device" } [lib] diff --git a/examples/cuda/gpu/path_tracer_gpu/src/lib.rs b/examples/cuda/gpu/path_tracer_gpu/src/lib.rs index d28fae17..3ff3cfdf 100644 --- a/examples/cuda/gpu/path_tracer_gpu/src/lib.rs +++ b/examples/cuda/gpu/path_tracer_gpu/src/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(target_os = "cuda", no_std, register_attr(nvvm_internal))] +#![cfg_attr(target_os = "cuda", no_std)] #![allow(clippy::missing_safety_doc)] extern crate alloc; diff --git a/examples/cuda/gpu/path_tracer_gpu/src/optix.rs b/examples/cuda/gpu/path_tracer_gpu/src/optix.rs index b4ee175f..8c534014 100644 --- a/examples/cuda/gpu/path_tracer_gpu/src/optix.rs +++ b/examples/cuda/gpu/path_tracer_gpu/src/optix.rs @@ -21,7 +21,6 @@ use optix_device::{ extern "C" { #[cfg(target_os = "cuda")] - #[cfg_attr(target_os = "cuda", nvvm_internal(addrspace(4)))] static PARAMS: LaunchParams<'static>; } From fdcea863e3a0a4a2324b5229eaaef21d1044d4fa Mon Sep 17 00:00:00 2001 From: trigpolynom Date: Sat, 15 Mar 2025 15:10:58 -0400 Subject: [PATCH 02/12] path_tracer --- examples/cuda/cpu/path_tracer/Cargo.toml | 12 ++++++------ examples/cuda/cpu/path_tracer/src/cpu/mod.rs | 4 ++-- examples/cuda/cpu/path_tracer/src/optix/mod.rs | 5 +++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/examples/cuda/cpu/path_tracer/Cargo.toml b/examples/cuda/cpu/path_tracer/Cargo.toml index 4eb7c4fc..7fb402a7 100644 --- a/examples/cuda/cpu/path_tracer/Cargo.toml +++ b/examples/cuda/cpu/path_tracer/Cargo.toml @@ -11,13 +11,13 @@ image = "0.25.5" path_tracer_gpu = { path = "../../gpu/path_tracer_gpu" } gpu_rand = { version = "0.1", path = "../../../../crates/gpu_rand" } optix = { version = "0.1", path = "../../../../crates/optix" } -glium = "0.36.0" -glutin = "0.32.2" -imgui = "0.12.0" -imgui-glium-renderer = "0.13.0" -imgui-winit-support = "0.13.0" +glium = "0.32.0" +glutin = "0.28.0" +imgui = "0.9.0" +imgui-glium-renderer = "0.9.0" +imgui-winit-support = "0.9.0" rayon = "1.10.0" -sysinfo = "0.33.1" +sysinfo = "0.24.0" anyhow = "1.0.53" [build-dependencies] diff --git a/examples/cuda/cpu/path_tracer/src/cpu/mod.rs b/examples/cuda/cpu/path_tracer/src/cpu/mod.rs index 3b67efeb..230bff86 100644 --- a/examples/cuda/cpu/path_tracer/src/cpu/mod.rs +++ b/examples/cuda/cpu/path_tracer/src/cpu/mod.rs @@ -6,7 +6,7 @@ use path_tracer_gpu::{ material::MaterialKind, render::generate_ray, scene::Scene, Object, Viewport, }; use rayon::prelude::*; -use sysinfo::{ProcessorExt, System, SystemExt}; +use sysinfo::{CpuExt, System, SystemExt}; use vek::{Clamp, Vec2, Vec3}; use crate::{common::Camera, cuda::SEED}; @@ -45,7 +45,7 @@ impl CpuRenderer { pub fn info(&self, ui: &Ui, system: &System) { let cores = system.physical_core_count().unwrap(); - let processor = &system.processors()[0]; + let processor = &system.cpus()[0]; let group = ui.begin_group(); ui.text(format!( diff --git a/examples/cuda/cpu/path_tracer/src/optix/mod.rs b/examples/cuda/cpu/path_tracer/src/optix/mod.rs index 3cea2967..9dc6514b 100644 --- a/examples/cuda/cpu/path_tracer/src/optix/mod.rs +++ b/examples/cuda/cpu/path_tracer/src/optix/mod.rs @@ -130,13 +130,13 @@ impl OptixRenderer { } } } - let buf = DeviceBuffer::from_slice(&aabbs)?; + let buf= DeviceBuffer::from_slice(&aabbs)?; let mut build_inputs = Vec::with_capacity(buf.len()); let mut aabb_slices = Vec::with_capacity(buf.len()); for i in 0..buf.len() { - aabb_slices.push(buf.index(i)); + aabb_slices.push(*buf.index(i)); } for i in 0..buf.len() { build_inputs.push(CustomPrimitiveArray::new( @@ -152,6 +152,7 @@ impl OptixRenderer { // correctly Ok(gas) } + fn build_scene_hitgroup_records( scene: &Scene, From 83770485f201c12e8c987e7575b37543f8e81fb1 Mon Sep 17 00:00:00 2001 From: trigpolynom Date: Sat, 15 Mar 2025 15:13:49 -0400 Subject: [PATCH 03/12] changed --- crates/find_cuda_helper/src/lib.rs | 54 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/crates/find_cuda_helper/src/lib.rs b/crates/find_cuda_helper/src/lib.rs index c0e6a4e2..7226876e 100644 --- a/crates/find_cuda_helper/src/lib.rs +++ b/crates/find_cuda_helper/src/lib.rs @@ -29,36 +29,36 @@ fn is_cuda_root_path>(path: P) -> bool { path.as_ref().join("include").join("cuda.h").is_file() } -// pub fn find_cuda_root() -> Option { -// // search through the common environment variables first -// for path in ["CUDA_PATH", "CUDA_ROOT", "CUDA_TOOLKIT_ROOT_DIR"] -// .iter() -// .filter_map(|name| std::env::var(*name).ok()) -// { -// if is_cuda_root_path(&path) { -// return Some(path.into()); -// } -// } - -// // If it wasn't specified by env var, try the default installation paths -// #[cfg(not(target_os = "windows"))] -// let default_paths = ["/usr/lib/cuda", "/usr/local/cuda", "/opt/cuda"]; -// #[cfg(target_os = "windows")] -// let default_paths = ["C:/CUDA"]; // TODO (AL): what's the actual path here? - -// for path in default_paths { -// if is_cuda_root_path(path) { -// return Some(path.into()); -// } -// } - -// None -// } - pub fn find_cuda_root() -> Option { - Some(PathBuf::from("/usr/lib/cuda")) + // search through the common environment variables first + for path in ["CUDA_PATH", "CUDA_ROOT", "CUDA_TOOLKIT_ROOT_DIR"] + .iter() + .filter_map(|name| std::env::var(*name).ok()) + { + if is_cuda_root_path(&path) { + return Some(path.into()); + } + } + + // If it wasn't specified by env var, try the default installation paths + #[cfg(not(target_os = "windows"))] + let default_paths = ["/usr/lib/cuda", "/usr/local/cuda", "/opt/cuda"]; + #[cfg(target_os = "windows")] + let default_paths = ["C:/CUDA"]; // TODO (AL): what's the actual path here? + + for path in default_paths { + if is_cuda_root_path(path) { + return Some(path.into()); + } + } + + None } +// pub fn find_cuda_root() -> Option { +// Some(PathBuf::from("/usr/lib/cuda")) +// } + #[cfg(target_os = "windows")] pub fn find_cuda_lib_dirs() -> Vec { if let Some(root_path) = find_cuda_root() { From ddd25984bbf0dce27d2b296f98dfe010f190599c Mon Sep 17 00:00:00 2001 From: trigpolynom Date: Sun, 16 Mar 2025 00:03:48 -0400 Subject: [PATCH 04/12] merged --- crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs b/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs index 71890d40..4a82a710 100644 --- a/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs +++ b/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs @@ -75,11 +75,7 @@ pub unsafe fn __miss__radiance() { } extern "C" { -<<<<<<< HEAD #[cfg_attr(target_os = "cuda", nvvm_internal::addrspace(4))] -======= - #[cfg_attr(target_os = "cuda", no_std)] ->>>>>>> d40b29f (fixing) static PARAMS: LaunchParams; } From d8c980751abf6af07b34b15e5a451eb88f000cb9 Mon Sep 17 00:00:00 2001 From: trigpolynom Date: Sun, 16 Mar 2025 00:04:23 -0400 Subject: [PATCH 05/12] merged --- crates/optix_device/src/lib.rs | 1 - examples/cuda/cpu/path_tracer/src/common.rs | 2 +- .../cuda/cpu/path_tracer/src/optix/mod.rs | 6 +++- examples/cuda/cpu/path_tracer/src/renderer.rs | 5 ++- examples/cuda/cpu/path_tracer/src/viewer.rs | 34 ++++++++++++------- 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/crates/optix_device/src/lib.rs b/crates/optix_device/src/lib.rs index 76c0539f..485c3753 100644 --- a/crates/optix_device/src/lib.rs +++ b/crates/optix_device/src/lib.rs @@ -1,5 +1,4 @@ #![cfg_attr(target_os = "cuda", feature(asm_experimental_arch))] -#[cfg(target_os = "cuda")] use core::arch::asm; extern crate alloc; diff --git a/examples/cuda/cpu/path_tracer/src/common.rs b/examples/cuda/cpu/path_tracer/src/common.rs index 7f342492..bfe69df0 100644 --- a/examples/cuda/cpu/path_tracer/src/common.rs +++ b/examples/cuda/cpu/path_tracer/src/common.rs @@ -1,4 +1,4 @@ -use glutin::event::{ +use glium::glutin::event::{ ElementState, Event, MouseButton, MouseScrollDelta, VirtualKeyCode, WindowEvent, }; use path_tracer_gpu::Viewport; diff --git a/examples/cuda/cpu/path_tracer/src/optix/mod.rs b/examples/cuda/cpu/path_tracer/src/optix/mod.rs index 9dc6514b..54aa248a 100644 --- a/examples/cuda/cpu/path_tracer/src/optix/mod.rs +++ b/examples/cuda/cpu/path_tracer/src/optix/mod.rs @@ -1,3 +1,5 @@ +use std::ops::Index; + use crate::cuda::CudaRendererBuffers; use anyhow::Result; use cust::{ @@ -135,8 +137,10 @@ impl OptixRenderer { let mut build_inputs = Vec::with_capacity(buf.len()); let mut aabb_slices = Vec::with_capacity(buf.len()); + let dev_slice = buf.as_slice(); + for i in 0..buf.len() { - aabb_slices.push(*buf.index(i)); + aabb_slices.push(&dev_slice[i]); } for i in 0..buf.len() { build_inputs.push(CustomPrimitiveArray::new( diff --git a/examples/cuda/cpu/path_tracer/src/renderer.rs b/examples/cuda/cpu/path_tracer/src/renderer.rs index bd2bfac3..099c9743 100644 --- a/examples/cuda/cpu/path_tracer/src/renderer.rs +++ b/examples/cuda/cpu/path_tracer/src/renderer.rs @@ -1,4 +1,7 @@ -use glutin::{event::Event, event_loop::ControlFlow}; +use glium::glutin::{ + event_loop::ControlFlow, + event::Event, + }; use imgui::Ui; use path_tracer_gpu::scene::Scene; use sysinfo::{System, SystemExt}; diff --git a/examples/cuda/cpu/path_tracer/src/viewer.rs b/examples/cuda/cpu/path_tracer/src/viewer.rs index 4943fc55..fa88a9a8 100644 --- a/examples/cuda/cpu/path_tracer/src/viewer.rs +++ b/examples/cuda/cpu/path_tracer/src/viewer.rs @@ -2,19 +2,26 @@ use glium::{ implement_vertex, index::{NoIndices, PrimitiveType}, texture::{RawImage2d, SrgbTexture2d}, + glutin::{ + window::WindowBuilder, + event_loop::{EventLoop, ControlFlow}, + ContextBuilder, + event::{Event, WindowEvent}, + dpi::PhysicalSize + }, uniform, Display, Program, Rect, Surface, VertexBuffer, }; -use glutin::{ - dpi::PhysicalSize, - event::{Event, WindowEvent}, - event_loop::{ControlFlow, EventLoop}, - window::WindowBuilder, - ContextBuilder, -}; +// use glutin::{ +// dpi::PhysicalSize, + // event::{Event, WindowEvent}, + // event_loop::{ControlFlow, EventLoop}, + // ContextBuilder, +// }; + use imgui::Condition; use imgui_winit_support::{HiDpiMode, WinitPlatform}; use path_tracer_gpu::scene::Scene; -use std::time::Instant; +use std::{ops::Deref, time::Instant}; use vek::Vec2; use crate::{common::Camera, renderer::Renderer, HEIGHT, WIDTH}; @@ -55,9 +62,9 @@ pub fn run(camera: &Camera, scene: &Scene) -> ! { let event_loop = EventLoop::new(); let wb = WindowBuilder::new() .with_title("Render") - .with_inner_size(PhysicalSize::new(WIDTH, HEIGHT)); + .with_inner_size(PhysicalSize::new(WIDTH as f64, HEIGHT as f64)); // Explicitly specify f64 let cb = ContextBuilder::new().with_vsync(true); - let display = Display::new(wb, cb, &event_loop).unwrap(); + let display = Display::new(wb, cb, event_loop.deref()).unwrap(); let renderer = Renderer::new(Vec2::new(WIDTH as usize, HEIGHT as usize), camera, scene); let mut viewer = ViewerRenderer::new(display, renderer); @@ -183,9 +190,9 @@ impl ViewerRenderer { .. } = self; let ui = self.imgui_ctx.frame(); - let out = imgui::Window::new("crab") + let out = ui.window("crab") .size([300.0, 300.0], Condition::FirstUseEver) - .build(&ui, || renderer.render(&ui)) + .build(|| renderer.render(&ui)) .unwrap(); let raw = @@ -221,7 +228,8 @@ impl ViewerRenderer { let gl_window = display.gl_window(); platform.prepare_render(&ui, gl_window.window()); - imgui_renderer.render(&mut target, ui.render()).unwrap(); + let draw_data = self.imgui_ctx.render(); + imgui_renderer.render(&mut target, draw_data).unwrap(); target.finish().unwrap(); } } From 512174df95d09a7340af889937896265a7474f7a Mon Sep 17 00:00:00 2001 From: trigpolynom Date: Sun, 16 Mar 2025 00:00:13 -0400 Subject: [PATCH 06/12] addressing comments --- crates/find_cuda_helper/src/lib.rs | 4 -- .../cuda/cpu/path_tracer/src/optix/mod.rs | 3 +- examples/cuda/cpu/path_tracer/src/renderer.rs | 5 +- examples/cuda/cpu/path_tracer/src/viewer.rs | 25 ++++------ examples/cuda/gpu/path_tracer_gpu/src/lib.rs | 1 - rustc-ice-2025-03-16T03_59_24-19970.txt | 48 +++++++++++++++++++ 6 files changed, 60 insertions(+), 26 deletions(-) create mode 100644 rustc-ice-2025-03-16T03_59_24-19970.txt diff --git a/crates/find_cuda_helper/src/lib.rs b/crates/find_cuda_helper/src/lib.rs index 7226876e..ed3b2f46 100644 --- a/crates/find_cuda_helper/src/lib.rs +++ b/crates/find_cuda_helper/src/lib.rs @@ -55,10 +55,6 @@ pub fn find_cuda_root() -> Option { None } -// pub fn find_cuda_root() -> Option { -// Some(PathBuf::from("/usr/lib/cuda")) -// } - #[cfg(target_os = "windows")] pub fn find_cuda_lib_dirs() -> Vec { if let Some(root_path) = find_cuda_root() { diff --git a/examples/cuda/cpu/path_tracer/src/optix/mod.rs b/examples/cuda/cpu/path_tracer/src/optix/mod.rs index 54aa248a..a4a82eb9 100644 --- a/examples/cuda/cpu/path_tracer/src/optix/mod.rs +++ b/examples/cuda/cpu/path_tracer/src/optix/mod.rs @@ -132,7 +132,7 @@ impl OptixRenderer { } } } - let buf= DeviceBuffer::from_slice(&aabbs)?; + let buf = DeviceBuffer::from_slice(&aabbs)?; let mut build_inputs = Vec::with_capacity(buf.len()); let mut aabb_slices = Vec::with_capacity(buf.len()); @@ -156,7 +156,6 @@ impl OptixRenderer { // correctly Ok(gas) } - fn build_scene_hitgroup_records( scene: &Scene, diff --git a/examples/cuda/cpu/path_tracer/src/renderer.rs b/examples/cuda/cpu/path_tracer/src/renderer.rs index 099c9743..a13a69f2 100644 --- a/examples/cuda/cpu/path_tracer/src/renderer.rs +++ b/examples/cuda/cpu/path_tracer/src/renderer.rs @@ -1,7 +1,4 @@ -use glium::glutin::{ - event_loop::ControlFlow, - event::Event, - }; +use glium::glutin::{event::Event, event_loop::ControlFlow}; use imgui::Ui; use path_tracer_gpu::scene::Scene; use sysinfo::{System, SystemExt}; diff --git a/examples/cuda/cpu/path_tracer/src/viewer.rs b/examples/cuda/cpu/path_tracer/src/viewer.rs index fa88a9a8..9631321a 100644 --- a/examples/cuda/cpu/path_tracer/src/viewer.rs +++ b/examples/cuda/cpu/path_tracer/src/viewer.rs @@ -1,22 +1,16 @@ use glium::{ - implement_vertex, - index::{NoIndices, PrimitiveType}, - texture::{RawImage2d, SrgbTexture2d}, glutin::{ - window::WindowBuilder, - event_loop::{EventLoop, ControlFlow}, - ContextBuilder, + dpi::PhysicalSize, event::{Event, WindowEvent}, - dpi::PhysicalSize + event_loop::{ControlFlow, EventLoop}, + window::WindowBuilder, + ContextBuilder, }, + implement_vertex, + index::{NoIndices, PrimitiveType}, + texture::{RawImage2d, SrgbTexture2d}, uniform, Display, Program, Rect, Surface, VertexBuffer, }; -// use glutin::{ -// dpi::PhysicalSize, - // event::{Event, WindowEvent}, - // event_loop::{ControlFlow, EventLoop}, - // ContextBuilder, -// }; use imgui::Condition; use imgui_winit_support::{HiDpiMode, WinitPlatform}; @@ -62,7 +56,7 @@ pub fn run(camera: &Camera, scene: &Scene) -> ! { let event_loop = EventLoop::new(); let wb = WindowBuilder::new() .with_title("Render") - .with_inner_size(PhysicalSize::new(WIDTH as f64, HEIGHT as f64)); // Explicitly specify f64 + .with_inner_size(PhysicalSize::new(WIDTH as f64, HEIGHT as f64)); let cb = ContextBuilder::new().with_vsync(true); let display = Display::new(wb, cb, event_loop.deref()).unwrap(); let renderer = Renderer::new(Vec2::new(WIDTH as usize, HEIGHT as usize), camera, scene); @@ -190,7 +184,8 @@ impl ViewerRenderer { .. } = self; let ui = self.imgui_ctx.frame(); - let out = ui.window("crab") + let out = ui + .window("crab") .size([300.0, 300.0], Condition::FirstUseEver) .build(|| renderer.render(&ui)) .unwrap(); diff --git a/examples/cuda/gpu/path_tracer_gpu/src/lib.rs b/examples/cuda/gpu/path_tracer_gpu/src/lib.rs index 3ff3cfdf..51614f77 100644 --- a/examples/cuda/gpu/path_tracer_gpu/src/lib.rs +++ b/examples/cuda/gpu/path_tracer_gpu/src/lib.rs @@ -1,4 +1,3 @@ -#![cfg_attr(target_os = "cuda", no_std)] #![allow(clippy::missing_safety_doc)] extern crate alloc; diff --git a/rustc-ice-2025-03-16T03_59_24-19970.txt b/rustc-ice-2025-03-16T03_59_24-19970.txt new file mode 100644 index 00000000..8b0c7d74 --- /dev/null +++ b/rustc-ice-2025-03-16T03_59_24-19970.txt @@ -0,0 +1,48 @@ +thread 'coordinator' panicked at /home/trigpolynom/.rustup/toolchains/nightly-2025-03-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/compiler/rustc_codegen_ssa/src/back/write.rs:1686:29: +/home/trigpolynom/.rustup/toolchains/nightly-2025-03-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/compiler/rustc_codegen_ssa/src/back/write.rs:1686:29: worker thread panicked +stack backtrace: + 0: 0x7b68e9c1b4a5 - std::backtrace::Backtrace::create::h4caae72ea1d639e2 + 1: 0x7b68e7fa9495 - std::backtrace::Backtrace::force_capture::hed7edc9d6077f7f2 + 2: 0x7b68e7118b5e - std[e7ccd300aecc5933]::panicking::update_hook::>::{closure#0} + 3: 0x7b68e7118417 - std[e7ccd300aecc5933]::panicking::update_hook::>::{closure#0} + 4: 0x7b68e7fc1da3 - std::panicking::rust_panic_with_hook::h98fc165e90ef379e + 5: 0x7b68e76badc2 - std[e7ccd300aecc5933]::panicking::begin_panic::::{closure#0} + 6: 0x7b68e76b5866 - std[e7ccd300aecc5933]::sys::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 7: 0x7b68e76b4792 - std[e7ccd300aecc5933]::panicking::begin_panic:: + 8: 0x7b68e7736517 - rustc_middle[464f7c4b782fc90]::util::bug::opt_span_bug_fmt::::{closure#0} + 9: 0x7b68e771de1a - rustc_middle[464f7c4b782fc90]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 10: 0x7b68e771dc8b - rustc_middle[464f7c4b782fc90]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 11: 0x7b68e5894bc0 - rustc_middle[464f7c4b782fc90]::util::bug::bug_fmt + 12: 0x7b68d2ab1bd4 - std::sys::backtrace::__rust_begin_short_backtrace::h8e99448a5d5a54a3 + 13: 0x7b68d2a840fe - core::ops::function::FnOnce::call_once{{vtable.shim}}::h88d5aa75b298fd0a + 14: 0x7b68e975b8ab - std::sys::pal::unix::thread::Thread::new::thread_start::h20288ab9ea215a81 + 15: 0x7b68e3694ac3 - start_thread + at ./nptl/pthread_create.c:442:8 + 16: 0x7b68e3726850 - __GI___clone3 + at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0 + 17: 0x0 - + + +rustc version: 1.87.0-nightly (8c392966a 2025-03-01) +platform: x86_64-unknown-linux-gnuthread 'coordinator' panicked at /home/trigpolynom/.rustup/toolchains/nightly-2025-03-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/compiler/rustc_codegen_ssa/src/back/write.rs:1686:29: +/home/trigpolynom/.rustup/toolchains/nightly-2025-03-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/compiler/rustc_codegen_ssa/src/back/write.rs:1686:29: worker thread panicked +stack backtrace: + 0: 0x7b68e9c1b4a5 - std::backtrace::Backtrace::create::h4caae72ea1d639e2 + 1: 0x7b68e7fa9495 - std::backtrace::Backtrace::force_capture::hed7edc9d6077f7f2 + 2: 0x7b68e7118b5e - std[e7ccd300aecc5933]::panicking::update_hook::>::{closure#0} + 3: 0x7b68e7fc1da3 - std::panicking::rust_panic_with_hook::h98fc165e90ef379e + 4: 0x7b68e76badc2 - std[e7ccd300aecc5933]::panicking::begin_panic::::{closure#0} + 5: 0x7b68e76b5866 - std[e7ccd300aecc5933]::sys::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 6: 0x7b68e76b4792 - std[e7ccd300aecc5933]::panicking::begin_panic:: + 7: 0x7b68e7736517 - rustc_middle[464f7c4b782fc90]::util::bug::opt_span_bug_fmt::::{closure#0} + 8: 0x7b68e771de1a - rustc_middle[464f7c4b782fc90]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 9: 0x7b68e771dc8b - rustc_middle[464f7c4b782fc90]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 10: 0x7b68e5894bc0 - rustc_middle[464f7c4b782fc90]::util::bug::bug_fmt + 11: 0x7b68d2ab1bd4 - std::sys::backtrace::__rust_begin_short_backtrace::h8e99448a5d5a54a3 + 12: 0x7b68d2a840fe - core::ops::function::FnOnce::call_once{{vtable.shim}}::h88d5aa75b298fd0a + 13: 0x7b68e975b8ab - std::sys::pal::unix::thread::Thread::new::thread_start::h20288ab9ea215a81 + 14: 0x7b68e3694ac3 - start_thread + at ./nptl/pthread_create.c:442:8 + 15: 0x7b68e3726850 - __GI___clone3 + at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0 + 16: 0x0 - From 105d451e8aa8da649fc5afb578bc918ea521d2d6 Mon Sep 17 00:00:00 2001 From: trigpolynom Date: Sun, 16 Mar 2025 00:00:40 -0400 Subject: [PATCH 07/12] removing log --- rustc-ice-2025-03-16T03_59_24-19970.txt | 48 ------------------------- 1 file changed, 48 deletions(-) delete mode 100644 rustc-ice-2025-03-16T03_59_24-19970.txt diff --git a/rustc-ice-2025-03-16T03_59_24-19970.txt b/rustc-ice-2025-03-16T03_59_24-19970.txt deleted file mode 100644 index 8b0c7d74..00000000 --- a/rustc-ice-2025-03-16T03_59_24-19970.txt +++ /dev/null @@ -1,48 +0,0 @@ -thread 'coordinator' panicked at /home/trigpolynom/.rustup/toolchains/nightly-2025-03-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/compiler/rustc_codegen_ssa/src/back/write.rs:1686:29: -/home/trigpolynom/.rustup/toolchains/nightly-2025-03-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/compiler/rustc_codegen_ssa/src/back/write.rs:1686:29: worker thread panicked -stack backtrace: - 0: 0x7b68e9c1b4a5 - std::backtrace::Backtrace::create::h4caae72ea1d639e2 - 1: 0x7b68e7fa9495 - std::backtrace::Backtrace::force_capture::hed7edc9d6077f7f2 - 2: 0x7b68e7118b5e - std[e7ccd300aecc5933]::panicking::update_hook::>::{closure#0} - 3: 0x7b68e7118417 - std[e7ccd300aecc5933]::panicking::update_hook::>::{closure#0} - 4: 0x7b68e7fc1da3 - std::panicking::rust_panic_with_hook::h98fc165e90ef379e - 5: 0x7b68e76badc2 - std[e7ccd300aecc5933]::panicking::begin_panic::::{closure#0} - 6: 0x7b68e76b5866 - std[e7ccd300aecc5933]::sys::backtrace::__rust_end_short_backtrace::::{closure#0}, !> - 7: 0x7b68e76b4792 - std[e7ccd300aecc5933]::panicking::begin_panic:: - 8: 0x7b68e7736517 - rustc_middle[464f7c4b782fc90]::util::bug::opt_span_bug_fmt::::{closure#0} - 9: 0x7b68e771de1a - rustc_middle[464f7c4b782fc90]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} - 10: 0x7b68e771dc8b - rustc_middle[464f7c4b782fc90]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> - 11: 0x7b68e5894bc0 - rustc_middle[464f7c4b782fc90]::util::bug::bug_fmt - 12: 0x7b68d2ab1bd4 - std::sys::backtrace::__rust_begin_short_backtrace::h8e99448a5d5a54a3 - 13: 0x7b68d2a840fe - core::ops::function::FnOnce::call_once{{vtable.shim}}::h88d5aa75b298fd0a - 14: 0x7b68e975b8ab - std::sys::pal::unix::thread::Thread::new::thread_start::h20288ab9ea215a81 - 15: 0x7b68e3694ac3 - start_thread - at ./nptl/pthread_create.c:442:8 - 16: 0x7b68e3726850 - __GI___clone3 - at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0 - 17: 0x0 - - - -rustc version: 1.87.0-nightly (8c392966a 2025-03-01) -platform: x86_64-unknown-linux-gnuthread 'coordinator' panicked at /home/trigpolynom/.rustup/toolchains/nightly-2025-03-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/compiler/rustc_codegen_ssa/src/back/write.rs:1686:29: -/home/trigpolynom/.rustup/toolchains/nightly-2025-03-02-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/compiler/rustc_codegen_ssa/src/back/write.rs:1686:29: worker thread panicked -stack backtrace: - 0: 0x7b68e9c1b4a5 - std::backtrace::Backtrace::create::h4caae72ea1d639e2 - 1: 0x7b68e7fa9495 - std::backtrace::Backtrace::force_capture::hed7edc9d6077f7f2 - 2: 0x7b68e7118b5e - std[e7ccd300aecc5933]::panicking::update_hook::>::{closure#0} - 3: 0x7b68e7fc1da3 - std::panicking::rust_panic_with_hook::h98fc165e90ef379e - 4: 0x7b68e76badc2 - std[e7ccd300aecc5933]::panicking::begin_panic::::{closure#0} - 5: 0x7b68e76b5866 - std[e7ccd300aecc5933]::sys::backtrace::__rust_end_short_backtrace::::{closure#0}, !> - 6: 0x7b68e76b4792 - std[e7ccd300aecc5933]::panicking::begin_panic:: - 7: 0x7b68e7736517 - rustc_middle[464f7c4b782fc90]::util::bug::opt_span_bug_fmt::::{closure#0} - 8: 0x7b68e771de1a - rustc_middle[464f7c4b782fc90]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} - 9: 0x7b68e771dc8b - rustc_middle[464f7c4b782fc90]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> - 10: 0x7b68e5894bc0 - rustc_middle[464f7c4b782fc90]::util::bug::bug_fmt - 11: 0x7b68d2ab1bd4 - std::sys::backtrace::__rust_begin_short_backtrace::h8e99448a5d5a54a3 - 12: 0x7b68d2a840fe - core::ops::function::FnOnce::call_once{{vtable.shim}}::h88d5aa75b298fd0a - 13: 0x7b68e975b8ab - std::sys::pal::unix::thread::Thread::new::thread_start::h20288ab9ea215a81 - 14: 0x7b68e3694ac3 - start_thread - at ./nptl/pthread_create.c:442:8 - 15: 0x7b68e3726850 - __GI___clone3 - at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0 - 16: 0x0 - From 2fd24f60689c9b71d8247d205cdd2f0cb7f2c162 Mon Sep 17 00:00:00 2001 From: trigpolynom Date: Sun, 16 Mar 2025 00:10:44 -0400 Subject: [PATCH 08/12] added cfg back --- crates/optix_device/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/optix_device/src/lib.rs b/crates/optix_device/src/lib.rs index 485c3753..76c0539f 100644 --- a/crates/optix_device/src/lib.rs +++ b/crates/optix_device/src/lib.rs @@ -1,4 +1,5 @@ #![cfg_attr(target_os = "cuda", feature(asm_experimental_arch))] +#[cfg(target_os = "cuda")] use core::arch::asm; extern crate alloc; From 16344c046ca5daf3f1190f5b41cc05dbb826debd Mon Sep 17 00:00:00 2001 From: trigpolynom Date: Sun, 16 Mar 2025 00:15:39 -0400 Subject: [PATCH 09/12] fixed cfg on launch params --- examples/cuda/gpu/path_tracer_gpu/src/optix.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/cuda/gpu/path_tracer_gpu/src/optix.rs b/examples/cuda/gpu/path_tracer_gpu/src/optix.rs index 8c534014..9e860b2a 100644 --- a/examples/cuda/gpu/path_tracer_gpu/src/optix.rs +++ b/examples/cuda/gpu/path_tracer_gpu/src/optix.rs @@ -20,7 +20,7 @@ use optix_device::{ }; extern "C" { - #[cfg(target_os = "cuda")] + #[cfg_attr(target_os = "cuda", nvvm_internal::addrspace(4))] static PARAMS: LaunchParams<'static>; } From 22e66a0ca10aa564e9683153e2d7b4f361eecc68 Mon Sep 17 00:00:00 2001 From: trigpolynom Date: Sun, 16 Mar 2025 17:02:53 -0400 Subject: [PATCH 10/12] clippy ran successfully --- .../examples/rust/ex04_mesh_gpu/src/lib.rs | 1 - crates/optix/src/acceleration.rs | 49 +++++++++---------- crates/optix/src/context.rs | 2 +- crates/optix/src/denoiser.rs | 20 ++++---- crates/optix/src/lib.rs | 2 +- crates/optix/src/pipeline.rs | 14 ++---- examples/cuda/cpu/add/src/main.rs | 2 +- 7 files changed, 40 insertions(+), 50 deletions(-) diff --git a/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs b/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs index 4a82a710..ea2877c1 100644 --- a/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs +++ b/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs @@ -4,7 +4,6 @@ use cuda_std::kernel; use optix_device::{ closesthit, get_launch_index, glam::*, - misc::*, payload, trace::TraversableHandle, trace::{trace, RayFlags}, diff --git a/crates/optix/src/acceleration.rs b/crates/optix/src/acceleration.rs index 377e0f09..b575dc65 100644 --- a/crates/optix/src/acceleration.rs +++ b/crates/optix/src/acceleration.rs @@ -703,16 +703,13 @@ bitflags::bitflags! { #[cfg_attr(windows, repr(i32))] #[cfg_attr(unix, repr(u32))] #[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Default)] pub enum BuildOperation { + #[default] Build = sys::OptixBuildOperation_OPTIX_BUILD_OPERATION_BUILD, Update = sys::OptixBuildOperation_OPTIX_BUILD_OPERATION_UPDATE, } -impl Default for BuildOperation { - fn default() -> Self { - BuildOperation::Build - } -} /// Configure how to handle ray times that are outside of the provided motion keys. /// @@ -983,7 +980,7 @@ pub struct CurveArray<'v, 'w, 'i> { primitive_index_offset: u32, } -impl<'v, 'w, 'i> Hash for CurveArray<'v, 'w, 'i> { +impl Hash for CurveArray<'_, '_, '_> { fn hash(&self, state: &mut H) { self.curve_type.hash(state); state.write_u32(self.num_primitives); @@ -1088,7 +1085,7 @@ impl<'v, 'w, 'i> CurveArray<'v, 'w, 'i> { } } -impl<'v, 'w, 'i> BuildInput for CurveArray<'v, 'w, 'i> { +impl BuildInput for CurveArray<'_, '_, '_> { fn to_sys(&self) -> sys::OptixBuildInput { sys::OptixBuildInput { type_: sys::OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_CURVES, @@ -1139,13 +1136,13 @@ impl From for sys::OptixPrimitiveType { #[repr(u32)] #[derive(Copy, Clone, PartialEq)] pub enum VertexFormat { - None = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_NONE as u32, - Float3 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_FLOAT3 as u32, - Float2 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_FLOAT2 as u32, - Half3 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_HALF3 as u32, - Half2 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_HALF2 as u32, - SNorm16 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_SNORM16_3 as u32, - SNorm32 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_SNORM16_2 as u32, + None = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_NONE, + Float3 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_FLOAT3, + Float2 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_FLOAT2, + Half3 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_HALF3, + Half2 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_HALF2, + SNorm16 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_SNORM16_3, + SNorm32 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_SNORM16_2, } /// Specifies the type of index data @@ -1299,7 +1296,7 @@ impl<'v, 'g, V: Vertex> TriangleArray<'v, 'g, V> { } } -impl<'v, 'g, V: Vertex> Hash for TriangleArray<'v, 'g, V> { +impl Hash for TriangleArray<'_, '_, V> { fn hash(&self, state: &mut H) { state.write_u32(self.num_vertices); state.write_usize(self.d_vertex_buffers.len()); @@ -1307,7 +1304,7 @@ impl<'v, 'g, V: Vertex> Hash for TriangleArray<'v, 'g, V> { } } -impl<'v, 'g, V: Vertex> BuildInput for TriangleArray<'v, 'g, V> { +impl BuildInput for TriangleArray<'_, '_, V> { fn to_sys(&self) -> sys::OptixBuildInput { sys::OptixBuildInput { type_: sys::OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_TRIANGLES, @@ -1382,7 +1379,7 @@ impl<'v, 'i, V: Vertex, I: IndexTriple> IndexedTriangleArray<'v, 'i, V, I> { } } -impl<'v, 'i, V: Vertex, I: IndexTriple> Hash for IndexedTriangleArray<'v, 'i, V, I> { +impl Hash for IndexedTriangleArray<'_, '_, V, I> { fn hash(&self, state: &mut H) { state.write_u32(self.num_vertices); state.write_usize(self.d_vertex_buffers.len()); @@ -1391,7 +1388,7 @@ impl<'v, 'i, V: Vertex, I: IndexTriple> Hash for IndexedTriangleArray<'v, 'i, V, } } -impl<'v, 'i, V: Vertex, I: IndexTriple> BuildInput for IndexedTriangleArray<'v, 'i, V, I> { +impl BuildInput for IndexedTriangleArray<'_, '_, V, I> { fn to_sys(&self) -> sys::OptixBuildInput { sys::OptixBuildInput { type_: sys::OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_TRIANGLES, @@ -1439,7 +1436,7 @@ pub struct CustomPrimitiveArray<'a, 's> { primitive_index_offset: u32, } -impl<'a, 'g, 's> Hash for CustomPrimitiveArray<'a, 's> { +impl<'g> Hash for CustomPrimitiveArray<'_, '_> { fn hash(&self, state: &mut H) { state.write_usize(self.aabb_buffers.len()); state.write_u32(self.num_primitives); @@ -1509,7 +1506,7 @@ impl<'a, 's> CustomPrimitiveArray<'a, 's> { } } -impl<'a, 's> BuildInput for CustomPrimitiveArray<'a, 's> { +impl BuildInput for CustomPrimitiveArray<'_, '_> { fn to_sys(&self) -> sys::OptixBuildInput { sys::OptixBuildInput { type_: sys::OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_CUSTOM_PRIMITIVES, @@ -1646,13 +1643,13 @@ impl<'i, 'a> InstanceArray<'i, 'a> { } } -impl<'i, 'a> Hash for InstanceArray<'i, 'a> { +impl Hash for InstanceArray<'_, '_> { fn hash(&self, state: &mut H) { state.write_usize(self.instances.len()); } } -impl<'i, 'a> BuildInput for InstanceArray<'i, 'a> { +impl BuildInput for InstanceArray<'_, '_> { fn to_sys(&self) -> sys::OptixBuildInput { cfg_if::cfg_if! { if #[cfg(any(feature="optix72", feature="optix73"))] { @@ -1692,13 +1689,13 @@ impl<'i> InstancePointerArray<'i> { } } -impl<'i> Hash for InstancePointerArray<'i> { +impl Hash for InstancePointerArray<'_> { fn hash(&self, state: &mut H) { state.write_usize(self.instances.len()); } } -impl<'i> BuildInput for InstancePointerArray<'i> { +impl BuildInput for InstancePointerArray<'_> { fn to_sys(&self) -> sys::OptixBuildInput { cfg_if::cfg_if! { if #[cfg(any(feature="optix72", feature="optix73"))] { @@ -1865,7 +1862,7 @@ impl MatrixMotionTransform { cust::memory::memcpy_htod( transform_ptr.as_raw(), transforms.as_ptr() as *const c_void, - std::mem::size_of::>() * num_keys, + std::mem::size_of_val(transforms), )?; let hnd = convert_pointer_to_traversable_handle( @@ -2014,7 +2011,7 @@ impl SrtMotionTransform { cust::memory::memcpy_htod( transform_ptr.as_raw(), srt_data.as_ptr() as *const c_void, - std::mem::size_of::() * num_keys, + std::mem::size_of_val(srt_data), )?; let hnd = convert_pointer_to_traversable_handle( diff --git a/crates/optix/src/context.rs b/crates/optix/src/context.rs index 3df7429f..486cfff1 100644 --- a/crates/optix/src/context.rs +++ b/crates/optix/src/context.rs @@ -107,7 +107,7 @@ impl DeviceContext { Ok(optix_call!(optixDeviceContextGetCacheDatabaseSizes( self.raw, &mut low, &mut high, )) - .map(|_| (low as usize, high as usize))?) + .map(|_| (low, high))?) } } diff --git a/crates/optix/src/denoiser.rs b/crates/optix/src/denoiser.rs index 4d60281c..3d71d6ff 100644 --- a/crates/optix/src/denoiser.rs +++ b/crates/optix/src/denoiser.rs @@ -222,9 +222,9 @@ impl Denoiser { stream.as_inner(), width, height, - state.as_device_ptr().as_raw() as u64, + state.as_device_ptr().as_raw(), state_size, - scratch.as_device_ptr().as_raw() as u64, + scratch.as_device_ptr().as_raw(), scratch_size ))?; } @@ -373,7 +373,7 @@ impl Denoiser { let raw_params = parameters.to_raw(); let mut out = input_image.to_raw(); - out.data = out_buffer.as_device_ptr().as_raw() as u64; + out.data = out_buffer.as_device_ptr().as_raw(); let layer = sys::OptixDenoiserLayer { input: input_image.to_raw(), @@ -388,14 +388,14 @@ impl Denoiser { self.raw, stream.as_inner(), &raw_params as *const _, - state.state.as_device_ptr().as_raw() as u64, + state.state.as_device_ptr().as_raw(), state.state.len(), &cloned as *const _, &layer as *const _, 1, // num-layers 0, // offsetX 0, // offsetY - state.scratch.as_device_ptr().as_raw() as u64, + state.scratch.as_device_ptr().as_raw(), state.scratch.len() ))?; } @@ -426,11 +426,11 @@ impl DenoiserParams<'_> { denoiseAlpha: self.denoise_alpha as u32, hdrIntensity: self .hdr_intensity - .map(|x| x.as_device_ptr().as_raw() as u64) + .map(|x| x.as_device_ptr().as_raw()) .unwrap_or_default(), hdrAverageColor: self .hdr_average_color - .map(|x| x.as_device_ptr().as_raw() as u64) + .map(|x| x.as_device_ptr().as_raw()) .unwrap_or_default(), blendFactor: self.blend_factor, } @@ -581,7 +581,7 @@ impl<'a> Image<'a> { let buf_size = std::mem::size_of::() * bytes.len(); assert!( - buf_size >= required_size as usize, + buf_size >= required_size, "Buffer for {}x{} {:?} image is not large enough, expected {} bytes, found {}", width, height, @@ -605,7 +605,7 @@ impl<'a> Image<'a> { let required_bytes = Self::required_buffer_size(format, width, height); let t_size = std::mem::size_of::(); // round-up division - let buf_size = (required_bytes + t_size - 1) / t_size; + let buf_size = required_bytes.div_ceil(t_size); UnifiedBuffer::new(&T::default(), buf_size) } @@ -630,7 +630,7 @@ impl<'a> Image<'a> { rowStrideInBytes: self.row_stride_in_bytes(), pixelStrideInBytes: self.pixel_stride_in_bytes(), format: self.format.to_raw(), - data: self.buffer.as_raw() as u64, + data: self.buffer.as_raw(), } } diff --git a/crates/optix/src/lib.rs b/crates/optix/src/lib.rs index f497eaa1..9bd5e525 100644 --- a/crates/optix/src/lib.rs +++ b/crates/optix/src/lib.rs @@ -177,7 +177,7 @@ pub unsafe fn launch( Ok(optix_call!(optixLaunch( pipeline.raw, stream.as_inner(), - pipeline_params.as_raw_ptr() as u64, + pipeline_params.as_raw_ptr(), pipeline_params.size_in_bytes(), &sbt.0, width, diff --git a/crates/optix/src/pipeline.rs b/crates/optix/src/pipeline.rs index a60cc4d7..4f66e299 100644 --- a/crates/optix/src/pipeline.rs +++ b/crates/optix/src/pipeline.rs @@ -135,7 +135,9 @@ pub struct Module { #[cfg_attr(windows, repr(i32))] #[cfg_attr(unix, repr(u32))] #[derive(Debug, Hash, PartialEq, Copy, Clone)] +#[derive(Default)] pub enum CompileOptimizationLevel { + #[default] Default = sys::OptixCompileOptimizationLevel::OPTIX_COMPILE_OPTIMIZATION_DEFAULT, Level0 = sys::OptixCompileOptimizationLevel::OPTIX_COMPILE_OPTIMIZATION_LEVEL_0, Level1 = sys::OptixCompileOptimizationLevel::OPTIX_COMPILE_OPTIMIZATION_LEVEL_1, @@ -143,27 +145,19 @@ pub enum CompileOptimizationLevel { Level3 = sys::OptixCompileOptimizationLevel::OPTIX_COMPILE_OPTIMIZATION_LEVEL_3, } -impl Default for CompileOptimizationLevel { - fn default() -> Self { - CompileOptimizationLevel::Default - } -} /// Module compilation debug level #[cfg_attr(windows, repr(i32))] #[cfg_attr(unix, repr(u32))] #[derive(Debug, Hash, PartialEq, Copy, Clone)] +#[derive(Default)] pub enum CompileDebugLevel { + #[default] None = sys::OptixCompileDebugLevel::OPTIX_COMPILE_DEBUG_LEVEL_NONE, LineInfo = sys::OptixCompileDebugLevel::OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO, Full = sys::OptixCompileDebugLevel::OPTIX_COMPILE_DEBUG_LEVEL_FULL, } -impl Default for CompileDebugLevel { - fn default() -> Self { - CompileDebugLevel::None - } -} cfg_if::cfg_if! { if #[cfg(any(feature="optix72", feature="optix73"))] { diff --git a/examples/cuda/cpu/add/src/main.rs b/examples/cuda/cpu/add/src/main.rs index 8ced6476..69c34b4c 100644 --- a/examples/cuda/cpu/add/src/main.rs +++ b/examples/cuda/cpu/add/src/main.rs @@ -45,7 +45,7 @@ fn main() -> Result<(), Box> { // current CUDA device/architecture. let (_, block_size) = func.suggested_launch_configuration(0, 0.into())?; - let grid_size = (NUMBERS_LEN as u32 + block_size - 1) / block_size; + let grid_size = (NUMBERS_LEN as u32).div_ceil(block_size); println!( "using {} blocks and {} threads per block", From 31a1b03e26f1d98e39396ec7ead609aacec4e7e3 Mon Sep 17 00:00:00 2001 From: trigpolynom Date: Sun, 16 Mar 2025 22:21:36 -0400 Subject: [PATCH 11/12] addressed --- crates/optix/src/acceleration.rs | 4 +--- crates/optix/src/pipeline.rs | 8 ++------ crates/rustc_codegen_nvvm/src/nvvm.rs | 10 ++-------- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/crates/optix/src/acceleration.rs b/crates/optix/src/acceleration.rs index b575dc65..e5997f5a 100644 --- a/crates/optix/src/acceleration.rs +++ b/crates/optix/src/acceleration.rs @@ -702,15 +702,13 @@ bitflags::bitflags! { /// Select which operation to perform with [`accel_build()`]. #[cfg_attr(windows, repr(i32))] #[cfg_attr(unix, repr(u32))] -#[derive(Debug, Copy, Clone, PartialEq)] -#[derive(Default)] +#[derive(Debug, Copy, Clone, PartialEq, Default)] pub enum BuildOperation { #[default] Build = sys::OptixBuildOperation_OPTIX_BUILD_OPERATION_BUILD, Update = sys::OptixBuildOperation_OPTIX_BUILD_OPERATION_UPDATE, } - /// Configure how to handle ray times that are outside of the provided motion keys. /// /// By default, the object will appear static (clamped) to the nearest motion diff --git a/crates/optix/src/pipeline.rs b/crates/optix/src/pipeline.rs index 4f66e299..a85e08e4 100644 --- a/crates/optix/src/pipeline.rs +++ b/crates/optix/src/pipeline.rs @@ -134,8 +134,7 @@ pub struct Module { /// Module compilation optimization level #[cfg_attr(windows, repr(i32))] #[cfg_attr(unix, repr(u32))] -#[derive(Debug, Hash, PartialEq, Copy, Clone)] -#[derive(Default)] +#[derive(Debug, Hash, PartialEq, Copy, Clone, Default)] pub enum CompileOptimizationLevel { #[default] Default = sys::OptixCompileOptimizationLevel::OPTIX_COMPILE_OPTIMIZATION_DEFAULT, @@ -145,12 +144,10 @@ pub enum CompileOptimizationLevel { Level3 = sys::OptixCompileOptimizationLevel::OPTIX_COMPILE_OPTIMIZATION_LEVEL_3, } - /// Module compilation debug level #[cfg_attr(windows, repr(i32))] #[cfg_attr(unix, repr(u32))] -#[derive(Debug, Hash, PartialEq, Copy, Clone)] -#[derive(Default)] +#[derive(Debug, Hash, PartialEq, Copy, Clone, Default)] pub enum CompileDebugLevel { #[default] None = sys::OptixCompileDebugLevel::OPTIX_COMPILE_DEBUG_LEVEL_NONE, @@ -158,7 +155,6 @@ pub enum CompileDebugLevel { Full = sys::OptixCompileDebugLevel::OPTIX_COMPILE_DEBUG_LEVEL_FULL, } - cfg_if::cfg_if! { if #[cfg(any(feature="optix72", feature="optix73"))] { #[repr(C)] diff --git a/crates/rustc_codegen_nvvm/src/nvvm.rs b/crates/rustc_codegen_nvvm/src/nvvm.rs index f49527ee..c73e14a9 100644 --- a/crates/rustc_codegen_nvvm/src/nvvm.rs +++ b/crates/rustc_codegen_nvvm/src/nvvm.rs @@ -155,20 +155,14 @@ pub fn codegen_bitcode_modules( /// linked when building the nvvm program. pub fn find_libdevice() -> Option> { if let Some(base_path) = find_cuda_root() { - let libdevice_dir = Path::new(&base_path).join("nvvm").join("libdevice"); - println!("Checking libdevice directory: {:?}", libdevice_dir); - - let libdevice_file = fs::read_dir(&libdevice_dir) + let libdevice_file = fs::read_dir(Path::new(&base_path).join("nvvm").join("libdevice")) .ok()? .filter_map(Result::ok) .find(|f| f.path().extension() == Some(OsStr::new("bc")))? .path(); - - println!("Found libdevice file: {:?}", libdevice_file); - + fs::read(libdevice_file).ok() } else { - println!("CUDA root not found"); None } } From 76e60a25bf55e5e11dadf1252a3d65e96ab299ee Mon Sep 17 00:00:00 2001 From: trigpolynom Date: Mon, 17 Mar 2025 23:11:54 -0400 Subject: [PATCH 12/12] format works and build works for linux --- crates/rustc_codegen_nvvm/src/nvvm.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/rustc_codegen_nvvm/src/nvvm.rs b/crates/rustc_codegen_nvvm/src/nvvm.rs index c73e14a9..88f5e8ef 100644 --- a/crates/rustc_codegen_nvvm/src/nvvm.rs +++ b/crates/rustc_codegen_nvvm/src/nvvm.rs @@ -160,7 +160,6 @@ pub fn find_libdevice() -> Option> { .filter_map(Result::ok) .find(|f| f.path().extension() == Some(OsStr::new("bc")))? .path(); - fs::read(libdevice_file).ok() } else { None