Skip to content

Commit

Permalink
disable fastmath for fallback backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-Leo-Smith committed Feb 11, 2025
1 parent c353e5d commit 643d97e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions include/luisa/runtime/byte_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<BufferUploadCommand> copy_from(const void *data) const noexcept;
[[nodiscard]] luisa::unique_ptr<BufferCopyCommand> copy_from(ByteBufferView source) const noexcept;
Expand Down
14 changes: 7 additions & 7 deletions src/backends/fallback/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
7 changes: 5 additions & 2 deletions src/runtime/byte_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<BufferDownloadCommand> ByteBuffer::copy_to(void *data) const noexcept {
_check_is_valid();
return view().copy_to(data);
Expand Down Expand Up @@ -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<BufferDownloadCommand> ByteBufferView::copy_to(void *data) const noexcept {
Expand Down

0 comments on commit 643d97e

Please sign in to comment.