Skip to content

Commit

Permalink
update submod, only insert comment when dump source is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
shiinamiyuki committed Nov 9, 2023
1 parent f143bdf commit ea3c8c4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
20 changes: 12 additions & 8 deletions luisa_compute/src/lang/debug.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::ffi::CString;
use std::fmt::Debug;
use std::{env, ffi::CString};

use crate::internal_prelude::*;

Expand Down Expand Up @@ -138,10 +138,20 @@ pub fn __assert(cond: impl Into<Expr<bool>>, msg: &str, file: &str, line: u32, c
});
}

/// Insert a comment to the generated source code.
/// *Note*: this is only effective when LUISA_DUMP_SOURCE is set to 1
pub fn comment(msg: &str) {
if !recording_started() {
return;
}
match env::var("LUISA_DUMP_SOURCE") {
Ok(s) => {
if s != "1" {
return;
}
}
Err(_) => return,
}
__current_scope(|b| {
b.comment(CBoxedSlice::new(
CString::new(msg).unwrap().into_bytes_with_nul(),
Expand All @@ -164,13 +174,7 @@ macro_rules! lc_comment_lineno {
))
};
($msg:literal, $e:expr) => {
$crate::lang::debug::with_lineno(
$msg,
file!(),
line!(),
column!(),
|| $e,
)
$crate::lang::debug::with_lineno($msg, file!(), line!(), column!(), || $e)
};
}

Expand Down
2 changes: 1 addition & 1 deletion luisa_compute/src/lang/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<T: Value> DevicePrint for Expr<T> {
}
impl<T: Value> DevicePrint for Var<T> {
fn fmt(&self, fmt: &mut DevicePrintFormatter) {
fmt.push_arg(self.node());
DevicePrint::fmt(&self.load(), fmt);
}
}

Expand Down
2 changes: 1 addition & 1 deletion luisa_compute_sys/LuisaCompute
Submodule LuisaCompute updated 50 files
+1 −1 .github/workflows/build-cmake.yml
+3 −1 .github/workflows/build-wheels.yml
+1 −1 .github/workflows/build-xmake.yml
+13 −2 CMakeLists.txt
+1 −1 include/luisa/ast/expression.h
+13 −4 include/luisa/backends/ext/denoiser_ext.h
+13 −13 include/luisa/backends/ext/dx_cuda_interop.h
+1 −0 include/luisa/core/thread_pool.h
+11 −0 include/luisa/dsl/builtin.h
+39 −39 include/luisa/dsl/sugar.h
+2 −2 pyproject.toml
+1 −1 scripts/cibw_install_deps.sh
+0 −7 scripts/validate_options.cmake
+65 −31 src/backends/common/CMakeLists.txt
+8 −0 src/backends/common/hlsl/hlsl_codegen.cpp
+1 −1 src/backends/common/hlsl/hlsl_codegen.h
+1 −1 src/backends/common/oidn_denoiser.cpp
+4 −1 src/backends/common/shader_print_formatter.h
+8 −3 src/backends/cuda/CMakeLists.txt
+30 −35 src/backends/cuda/cuda_builtin/cuda_device_resource.h
+6,382 −6,402 src/backends/cuda/cuda_builtin_embedded.cpp
+1 −1 src/backends/cuda/cuda_builtin_embedded.h
+111 −21 src/backends/cuda/cuda_codegen_ast.cpp
+2 −0 src/backends/cuda/cuda_codegen_ast.h
+2 −1 src/backends/cuda/cuda_command_encoder.cpp
+3 −3 src/backends/cuda/cuda_device.cpp
+14 −8 src/backends/cuda/extensions/cuda_denoiser.cpp
+7 −5 src/backends/cuda/extensions/cuda_denoiser.h
+0 −0 src/backends/cuda/extensions/cuda_dstorage.cpp
+3 −2 src/backends/cuda/extensions/cuda_dstorage.h
+5 −5 src/backends/cuda/extensions/cuda_texture_compression.cpp
+0 −0 src/backends/cuda/extensions/cuda_texture_compression.h
+3 −1 src/backends/cuda/xmake.lua
+1 −0 src/backends/dx/CMakeLists.txt
+6 −5 src/backends/dx/DXApi/cuda_interop.cpp
+5 −0 src/backends/metal/metal_builtin/metal_device_lib.metal
+3,329 −3,321 src/backends/metal/metal_builtin_embedded.cpp
+1 −1 src/backends/metal/metal_builtin_embedded.h
+3 −1 src/backends/metal/metal_codegen_ast.cpp
+3 −1 src/core/thread_pool.cpp
+32 −2 src/ir/ir2ast.cpp
+39 −8 src/py/export_runtime.cpp
+4 −0 src/py/py_stream.cpp
+4 −2 src/py/py_stream.h
+3 −3 src/rust/luisa_compute_ir/src/ast2ir.rs
+1 −0 src/tests/CMakeLists.txt
+68 −0 src/tests/python/test-pytorch-interop.py
+32 −0 src/tests/test_cuda_dx_interop.cpp
+40 −31 src/tests/test_denoiser.cpp
+1 −0 src/tests/xmake.lua

0 comments on commit ea3c8c4

Please sign in to comment.