From 643d97e878a33022f69446638e1c730452d8db81 Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Tue, 11 Feb 2025 15:52:36 +0800 Subject: [PATCH] disable fastmath for fallback backend --- include/luisa/runtime/byte_buffer.h | 1 + src/backends/fallback/CMakeLists.txt | 14 +++++++------- src/runtime/byte_buffer.cpp | 7 +++++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/include/luisa/runtime/byte_buffer.h b/include/luisa/runtime/byte_buffer.h index ea71e33bd..c42101ca9 100644 --- a/include/luisa/runtime/byte_buffer.h +++ b/include/luisa/runtime/byte_buffer.h @@ -35,6 +35,7 @@ class LC_RUNTIME_API ByteBuffer final : public Resource { using Resource::operator bool; [[nodiscard]] ByteBufferView view() const noexcept; + [[nodiscard]] ByteBufferView view(size_t offset_bytes, size_t size_bytes) const noexcept; [[nodiscard]] luisa::unique_ptr copy_from(const void *data) const noexcept; [[nodiscard]] luisa::unique_ptr copy_from(ByteBufferView source) const noexcept; diff --git a/src/backends/fallback/CMakeLists.txt b/src/backends/fallback/CMakeLists.txt index 5691821ea..0de2973ff 100644 --- a/src/backends/fallback/CMakeLists.txt +++ b/src/backends/fallback/CMakeLists.txt @@ -107,13 +107,13 @@ if (LLVM_FOUND AND embree_FOUND) target_link_libraries(luisa-compute-backend-fallback PRIVATE ${LLVM_LIBS}) endif () - if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - target_compile_options(luisa-compute-backend-fallback PRIVATE - /wd4624 /wd4996 # do not complain about LLVM - /fp:fast /fp:contract /fp:except- /ARCH:AVX2) - else () - target_compile_options(luisa-compute-backend-fallback PRIVATE -ffast-math) - endif () + # if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + # target_compile_options(luisa-compute-backend-fallback PRIVATE + # /wd4624 /wd4996 # do not complain about LLVM + # /fp:fast /fp:contract /fp:except- /ARCH:AVX2) + # else () + # target_compile_options(luisa-compute-backend-fallback PRIVATE -ffast-math) + # endif () elseif (NOT LUISA_COMPUTE_CHECK_BACKEND_DEPENDENCIES) message(FATAL_ERROR "LLVM or Embree not found for the fallback backend.") diff --git a/src/runtime/byte_buffer.cpp b/src/runtime/byte_buffer.cpp index 06f02fef0..cb4413baf 100644 --- a/src/runtime/byte_buffer.cpp +++ b/src/runtime/byte_buffer.cpp @@ -43,6 +43,10 @@ ByteBufferView ByteBuffer::view() const noexcept { return ByteBufferView{native_handle(), handle(), 0u, _size_bytes, _size_bytes}; } +ByteBufferView ByteBuffer::view(size_t offset_bytes, size_t size_bytes) const noexcept { + return view().subview(offset_bytes, size_bytes); +} + luisa::unique_ptr ByteBuffer::copy_to(void *data) const noexcept { _check_is_valid(); return view().copy_to(data); @@ -71,8 +75,7 @@ ByteBufferView ByteBufferView::subview(size_t offset_bytes, size_t size_bytes) c if (offset_bytes + size_bytes > _size) [[unlikely]] { detail::error_buffer_subview_overflow(offset_bytes, size_bytes, _size); } - return ByteBufferView{_native_handle, _handle, _offset_bytes + offset_bytes, - size_bytes, _total_size}; + return ByteBufferView{_native_handle, _handle, _offset_bytes + offset_bytes, size_bytes, _total_size}; } luisa::unique_ptr ByteBufferView::copy_to(void *data) const noexcept {