Skip to content

Commit adf4ce3

Browse files
committed
fix build (disable error-on-warnings), WIP multikernel support for nThreads specificaiton
1 parent acd0768 commit adf4ce3

File tree

6 files changed

+185
-119
lines changed

6 files changed

+185
-119
lines changed

CMakeLists.txt

+12-10
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # export compile_commands.json to use with
99
set(CMAKE_CXX_STANDARD 17)
1010
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1111

12-
1312
option(USE_LOCAL_LIBS "Use local libraries instead of fetching from the internet" OFF)
1413

1514
# Define paths for local and remote repositories
@@ -30,11 +29,19 @@ IF (NOT WEBGPU_TAG)
3029
ENDIF()
3130
message(STATUS "Using WebGPU distribution tag: ${WEBGPU_TAG}")
3231

33-
IF (WEBGPU_TAG STREQUAL "dawn")
34-
# Pin the dawn backend to a specific commit
35-
set(WEBGPU_TAG "1025b977e1927b6d0327e67352f90feb4bcf8274")
32+
# TODO - look into dawn version check build issue :(
33+
# ABSL_PROPAGATE_CXX_STD
34+
# https://github.com/google/dawn/blob/59b4421352ada94c98f0f3d63913c117378d970c/CMakeLists.txt#L246C5-L246C27
35+
36+
if (WEBGPU_TAG STREQUAL "dawn")
37+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWEBGPU_BACKEND_DAWN")
38+
# actually use specific commit
39+
# set(WEBGPU_TAG "1025b977e1927b6d0327e67352f90feb4bcf8274") # prev commit
40+
# set(WEBGPU_TAG "acf972b7b909f52e183bdae3971b93bb13d4a29e") # latest commit
41+
# add_compile_options(-UABSL_INTERNAL_AT_LEAST_CXX20)
42+
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -UABSL_INTERNAL_AT_LEAST_CXX20")
3643
message(STATUS "Using Dawn backend")
37-
ENDIF()
44+
endif()
3845

3946
FetchContent_Declare(
4047
webgpu
@@ -44,11 +51,6 @@ FetchContent_Declare(
4451
)
4552
FetchContent_MakeAvailable(webgpu)
4653

47-
if (WEBGPU_TAG STREQUAL "dawn")
48-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWEBGPU_BACKEND_DAWN")
49-
message(STATUS "Using Dawn backend")
50-
endif()
51-
5254
option(FASTBUILD "Option to enable fast builds" OFF)
5355
if(FASTBUILD)
5456
set(CMAKE_BUILD_TYPE None) # Avoid default flags of predefined build types

Makefile

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ USE_WGPU=-DWEBGPU_TAG=wgpu
1010
.PHONY: demo tests libgpu debug build check-entr watch-demo watch-tests clean
1111

1212
# Add --trace to see the cmake commands
13-
FLAGS = -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_CXX_COMPILER=$(CXX)
13+
# absl c++20 check is breaking mac builds
14+
FLAGS = -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_CXX_COMPILER=$(CXX) -DABSL_INTERNAL_AT_LEAST_CXX20=OFF
1415

1516
# TODO(avh): decide whether to use wgpu as default
1617
FASTBUILD_FLAGS = $(FLAGS) -DFASTBUILD:BOOL=ON
@@ -40,6 +41,9 @@ libgpu: check-dependencies
4041
debug: check-dependencies
4142
$(CMAKE_CMD) $(DEBUG_FLAGS) && make -j$(NUM_JOBS) $(TARGET_ALL)
4243

44+
debug-wgpu: check-dependencies
45+
$(CMAKE_CMD) $(DEBUG_FLAGS) $(USE_WGPU) && make -j$(NUM_JOBS) $(TARGET_ALL)
46+
4347
build: check-dependencies
4448
$(CMAKE_CMD) $(RELEASE_FLAGS) && make -j$(NUM_JOBS) $(TARGET_ALL)
4549

@@ -57,6 +61,7 @@ watch-tests: check-entr check-dependencies
5761

5862
# experimental
5963
watch-tests-wgpu: check-entr check-dependencies
64+
# export RUST_TRACE=1
6065
$(CMAKE_CMD) $(FASTBUILD_FLAGS) $(USE_WGPU) && ls ../* ../utils/* | entr -s "rm -f $(TARGET_TESTS) && make -j$(NUM_JOBS) $(TARGET_TESTS) && ./$(TARGET_TESTS)"
6166

6267
watch-demo-local: check-entr check-dependencies

examples/render/run.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,13 @@ int main(int argc, char **argv) {
124124
DispatchKernel(ctx, renderKernel);
125125
Wait(ctx, renderKernel.future);
126126
ToCPU(ctx, devScreen, screen.data(), sizeof(screen));
127-
// Update the time field, write pparams to GPU, and create a new command buffer
127+
// Update the time field, write pparams to GPU, and create a new command
128+
// buffer
128129
params.time = getCurrentTimeInMilliseconds() - zeroTime;
129130
wgpuQueueWriteBuffer(ctx.queue,
130131
renderKernel.buffers[renderKernel.numBuffers - 1], 0,
131132
static_cast<void *>(&params), sizeof(params));
132-
ResetCommandBuffer(ctx.device, shader.workgroupSize, {NCOLS, NROWS, 1},
133+
ResetCommandBuffer(ctx.device, /*nthreads*/ {NCOLS, NROWS, 1},
133134
renderKernel);
134135

135136
static const char intensity[] = "$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/"

0 commit comments

Comments
 (0)