30 Commits

Author SHA1 Message Date
Jorge Ortega
295459dcea refactor(cust_raw): Parse macro function renames in cuda headers. (#187)
Adds a custom bindgen callback that prevents function renames due to macro defines while still linking to the intend function after macro expansion. It does this by tracking macros when generating the bindings, so that it can change the name of the function back to what it was before the macro changed and link to the macro expanded function name. Doing so helps prevents breaking changes across CUDA versions when generating the bindings, and generates function bindings that match those used in Nvidia's CUDA documentation.

misc.: optix-sys rebuilds if related optix environment variables change.
misc.: unpin cc and jobserver from add example.
2025-04-04 10:37:47 -07:00
Jorge Ortega
2b33f4e47f path_tracer builds and runs on windows
- Addresses some review comments.
- Updates `sysinfo` in `path_tracer` to latest.
- Removes the copy of optix_wrapper.rs used for debugging.
2025-03-19 13:47:19 -04:00
trigpolynom
210af5d38c fixing path_tracer and build works for linux 2025-03-19 13:47:19 -04:00
Jorge Ortega
8fea329604 denoiser example: Replace image::io::Reader with image::ImageReader 2025-03-13 22:17:37 -04:00
Jorge Ortega
e079b57224 Fix nvvm_internal attribute usage. add example now compiles and runs!
`register_attr` was removed in favor of `register_tool`. This updates how the nvvm attributes are applied in our proc_macros and how the nvvm backend parses them. Also removes redundant applications of no_std, as cuda_builder applies it to all crates built on the cuda target via rustc flags.

The add example crate now compiles and runs the geneated ptx! :D
2025-03-13 10:45:20 -04:00
Jorge Ortega
25b3fddad7 Run cargo fmt 2025-03-13 10:45:20 -04:00
Jorge Ortega
689a7a2055 Updates rust-toolchain to nightly-02-20.
This includes several updates to the backend based on changes in
rustc_codegen_llvm, which brings some bug fixes and a refactor to debug
info. This fixes failing dependencies that resolved to newer versions
that failed to build on the previous nightly.

Removes depending on rustc_codegen_llvm as it can't be imported with the
new toolchain for some reason.

The example cuda kernals fail to build. Their dependencies
cause nvvm to abort with ICE.
2025-03-13 10:45:20 -04:00
Alex Eisenschmied
d00cf26f0e Updated crates to use new versions of Dependencies (#146)
* Dependencies updated and toolchain updated to a modern version of rust nightly. Had to update the vek, sysinfo, and rayon crates, since they wer pulling in code from dependencies that has long since been broken.

rustc codegen nvvm is still broken, seems to have a number of issues. Once I got Optix installed and setup, I started having trouble with llvm. The build file seems to need llvm-config, which does not ship with precompiled binaries for llvm. I compiled llvm from source, but am still unable to get the build file to find that correctly. There are also a number of regular errors which will need to resolved slowly.

* Dependencies for all crates should be updated to the latest available versions. Going to tackle any breaking changes next

* Two bit flag fields in cust/texture.rs did not implement traits required by the structs they were contained in. This has been resolved

* I both of these files, the field access was replaced with a getter method, which was previously throwing an error

* ArrayObjectFlags needed Debug and PartialEq traits to be derived, was throwing an error before

* updating another file

* removed once_cell as dependency from rustc_codegen_nvvm. The goal was to replace with the standardized version from the std library, but the dependency does not seem to be in use anyway
2025-03-07 15:11:30 -04:00
Vollkornaffe
54bd55ee40 Update Add Example & Getting Started (#117)
* Figure out what works for the add example

* Update guide's CUDA SDK versions

See also https://github.com/Rust-GPU/Rust-CUDA/issues/100
2025-01-27 12:41:54 -04:00
rdambrosio
17093186ac Fix: fix optix denoiser example 2022-03-17 18:18:22 -04:00
rdambrosio
f60ea047f5 Chore: update versions for 0.3 release 2022-02-07 14:45:11 -05:00
rdambrosio
f49291aabb Chore: clean up unused code warnings 2022-01-31 03:04:57 -05:00
rdambrosio
b62a97d150 Feat: add dielectric to path tracer 2022-01-31 02:57:39 -05:00
rdambrosio
70acd08f4b Feat: add OptiX (hardware rt) support to toy path tracer 2022-01-31 01:40:30 -05:00
rdambrosio
f517516bf4 Feat: more bytemuck-based features for devicebuffer/deviceslice 2022-01-22 18:35:16 -05:00
rdambrosio
0c700db0ea Feat: add proper debug option to cuda_builder, run fmt 2022-01-21 23:36:26 -05:00
rdambrosio
8013378e4c Feat: sort changelog and implement DeviceCopy derive in cust_core 2022-01-21 23:16:08 -05:00
Anders Langlands
5f5e451e59 Feat: Tons of cust changes and start of OptiX (hardware rt) work
* wip

* bootstrap enough optix to get ex02 working

* Add example 03

Generate an animated pattern in the raygen and display it in a window using glfw

* add logging callback

* remove ustr

* Manually create OptixShaderBindingTable

field-by-field instead of transmute

* Switch Module and Pipeline methods to their structs

Instead of having them on DeviceContext

* Switch Module, Pipeline, ProgramGroup methods to their structs

Instead of having them on DeviceContext

* Refactor: remove dead imports

* derive DeviceCopy

* typo

* Better error message

* Move destroy to Drop impl

* typo

* rename OptixContext to DeviceContext

* Make launch params variable name optional

* Remove Clone from Module and ProgramGroup

* Make log callback safe

User catch_unwind to guard against panic in C. Remove note about lifetime of
closure since it's 'static anyway. Have set_log_callback return a Result instead
of panicking on error.

* add wip glam support

* dont panic in drop

* Rework DevicePointer on top of CUdeviceptr

This switches out *T for CUdeviceptr in DevicePointer. This has the
knock-on effect of removing a lot of "pretend we're a CPU pointer" stuff
from downstream types like DeviceSlice.

* wip

* bootstrap enough optix to get ex02 working

* Add example 03

Generate an animated pattern in the raygen and display it in a window using glfw

* add logging callback

* remove ustr

* Manually create OptixShaderBindingTable

field-by-field instead of transmute

* Switch Module and Pipeline methods to their structs

Instead of having them on DeviceContext

* Switch Module, Pipeline, ProgramGroup methods to their structs

Instead of having them on DeviceContext

* Refactor: remove dead imports

* derive DeviceCopy

* typo

* Better error message

* Move destroy to Drop impl

* typo

* rename OptixContext to DeviceContext

* Make launch params variable name optional

* Remove Clone from Module and ProgramGroup

* Make log callback safe

User catch_unwind to guard against panic in C. Remove note about lifetime of
closure since it's 'static anyway. Have set_log_callback return a Result instead
of panicking on error.

* add wip glam support

* dont panic in drop

* wip accel support

* Add accel wip

Enough acceleration structure stuff to get example 04 running, and
rebasing on top of deviceptr branch

* Rework acceleration structure stuff

Provide simple internally allocating API for Accel, but also allow
creating one from raw parts to let user handle memory allocation.
Original API kept as free functions and marked unsafe.

Implement all build input types.

Add mint support to cust and optix.

* add lifetime bound on Instance to referenced Accel

* Have DeviceCopy impl for lifetime markers use null type

* Add unsaafe from_handle ctor

* Add update for DynamicAccel

* Hash build inputs to ensure update is sound

* Add relocation info

* Add remaning DeviceContext methods

* Correct docstrings

* Add doc comments

* Add a prelude

* Own the geometry flags array

* Add prelude

* own the geometry flags array and add support for pre_transform

* Fill out context and add some module docs

* Add some module docs

* Update to latest library changes

* Add more docs

* Remove mut requirement for getting pointer

* Add a simple memcpy_htod wrapper

* Add back pointer offset methods

* Big structure reorg and documentation push

- Reorganized the module structure to something less fragmented. Modules
  are longer but more cohesive.
- Integrated the optix programming guide inline into the module
  documentation.

You need to build the docs with:
RUSTDOCFLAGS="--html-in-header katex-header.html"  cargo doc --no-deps

To see the equations (this is done automatically on docs.rs)

* Wrap SBT properly

* Rename transform types

* Simplify AccelBuildOptions creation

Just take a build flags and move everything else to builders

* Hide programming guide in details tags

* Adapt to latest changes

* Fix toolchain version

* Fix name of DeviceContext

* first optix rust test

* Set ALLOW_COMPACTION in build options

* Use find_cuda_helper to get cuda path

* Handle differering enum representation on windows and linux

* Add DeviceVariable

* Add DeviceMemory trait

Abstracts over different device storage representations

* Add mem_get_info

* Add external memory

* Add a few more types to prelude

* Add more types

* Rework on top of new DeviceVariable

* first optix rust test

* tweak build

* update to latest optix changes

* Split DeviceCopy into cust_core

* update to latest optix changes

* trying to get print working

* tweak test kernel

* stop llvm optimizing out LaunchParams

* Chore: update cargo.toml dep versions

* Feat: second pass for fixing conflicts

* Feat: delete as_ptr and as_mut_ptr on DeviceSlice

* Revert "Feat: delete as_ptr and as_mut_ptr on DeviceSlice"

This reverts commit e858fdcaf3.

* Feat: experiment with deleting as_ptr and as_mut_ptr

* Fix issues and warnings

* Chore: run formatting

* Chore: exclude examples from building in CI

* Feat: update changelog with changes, misc changes before merge

Co-authored-by: rdambrosio <rdambrosio016@gmail.com>
2022-01-21 18:08:05 -05:00
rdambrosio
e97db1e5a3 Feat: WIP module rework (cubins dont work lol) 2022-01-19 13:01:16 -05:00
rdambrosio
e114af4c41 Chore: update cuda_std version 2021-12-05 12:59:36 -05:00
rdambrosio
63c9f56165 Chore: Rust CUDA 0.2 2021-12-05 12:36:27 -05:00
Riccardo D'Ambrosio
2a5eb69772 Feat: Implement Dead Code Elimination (no more gigantic PTX files 🎉 ) (#12)
* Feat: start implementing DCE/module merging

* Feat: remove useless deps graph stuff and remove mentions in docs

* Feat: rename path_tracer kernels name and commit ptx files

* Feat: add #[externally_visible], ignore ptx files, disable trace!
2021-11-28 17:16:09 -05:00
rdambrosio
4caa722649 Fix: use vek feature in path_tracer_gpu 2021-11-26 16:52:25 -05:00
rdambrosio
f8caca697a Feat: cust 0.2 (gpu_rand 0.1.1) 2021-11-26 13:26:48 -05:00
rdambrosio
555c53123a Feat: rename Dslice to DeviceSlice, fix clippy errs, start adding CI 2021-11-24 17:48:33 -05:00
rdambrosio
017d5da48c Feat: remove the need for &mut self in GpuBox and GpuBuffer 2021-11-24 16:58:34 -05:00
rdambrosio
93088f07cd Feat: Fix function attrs and begin address space stuff 2021-11-18 23:02:44 -05:00
rdambrosio
05d32ca043 Feat: add simple example and use u32 in thread to reduce register use 2021-11-15 13:27:06 -05:00
rdambrosio
7df8b4557b Feat: add path tracer to examples 2021-11-13 20:11:39 -05:00
rdambrosio
ddf471af1a Feat: fix the denoiser and add denoiser example 2021-10-27 22:38:22 -04:00