Record build profile and temporal raster cost in lighting benchmark
This commit is contained in:
@@ -91,6 +91,8 @@ if(BUILD_TESTING)
|
|||||||
add_executable(faset_p3_lighting_benchmark
|
add_executable(faset_p3_lighting_benchmark
|
||||||
"${PROJECT_SOURCE_DIR}/examples/renderer/p3_lighting_benchmark.cpp")
|
"${PROJECT_SOURCE_DIR}/examples/renderer/p3_lighting_benchmark.cpp")
|
||||||
target_link_libraries(faset_p3_lighting_benchmark PRIVATE faset_render faset_core)
|
target_link_libraries(faset_p3_lighting_benchmark PRIVATE faset_render faset_core)
|
||||||
|
target_compile_definitions(faset_p3_lighting_benchmark PRIVATE
|
||||||
|
FASET_BENCHMARK_CONFIGURATION="$<CONFIG>")
|
||||||
add_test(NAME render_lighting_benchmark_schema COMMAND
|
add_test(NAME render_lighting_benchmark_schema COMMAND
|
||||||
"${Python3_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/tests/test_p3_lighting_benchmark.py")
|
"${Python3_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/tests/test_p3_lighting_benchmark.py")
|
||||||
set_tests_properties(render_lighting_benchmark_schema PROPERTIES LABELS "p3" TIMEOUT 90)
|
set_tests_properties(render_lighting_benchmark_schema PROPERTIES LABELS "p3" TIMEOUT 90)
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ Options parse(int argc, char** argv) {
|
|||||||
else if (name == "--run-index") options.run_index = number(value, name);
|
else if (name == "--run-index") options.run_index = number(value, name);
|
||||||
else if (name == "--commit") options.commit = value;
|
else if (name == "--commit") options.commit = value;
|
||||||
else if (name == "--driver") options.driver = value;
|
else if (name == "--driver") options.driver = value;
|
||||||
else if (name == "--csv") options.csv = value;
|
else if (name == "--csv") options.csv = faset::path_from_utf8(value);
|
||||||
else if (name == "--capture") options.capture = value;
|
else if (name == "--capture") options.capture = faset::path_from_utf8(value);
|
||||||
else if (name == "--shadows") {
|
else if (name == "--shadows") {
|
||||||
if (value != "on" && value != "off")
|
if (value != "on" && value != "off")
|
||||||
throw std::invalid_argument("--shadows must be on or off");
|
throw std::invalid_argument("--shadows must be on or off");
|
||||||
@@ -165,14 +165,16 @@ void benchmark(const Options& options) {
|
|||||||
for (unsigned i = 0; i < options.warmup; ++i)
|
for (unsigned i = 0; i < options.warmup; ++i)
|
||||||
renderer.render(scene);
|
renderer.render(scene);
|
||||||
if (!options.csv.parent_path().empty())
|
if (!options.csv.parent_path().empty())
|
||||||
fs::create_directories(options.csv.parent_path());
|
fs::create_directories(faset::native_io_path(options.csv.parent_path()));
|
||||||
std::ofstream csv(options.csv);
|
std::ofstream csv(faset::native_io_path(options.csv));
|
||||||
if (!csv)
|
if (!csv)
|
||||||
throw std::runtime_error("Cannot open benchmark CSV: " + options.csv.string());
|
throw std::runtime_error("Cannot open benchmark CSV: " + faset::path_to_utf8(options.csv));
|
||||||
csv << "light_count,shadows,visibility,effective_visibility,lighting_path,run_index,frame,"
|
csv << "light_count,shadows,visibility,effective_visibility,lighting_path,"
|
||||||
|
"build_configuration,run_index,frame,"
|
||||||
"device,driver,commit,width,height,validation_enabled,validation_errors,"
|
"device,driver,commit,width,height,validation_enabled,validation_errors,"
|
||||||
"submitted_local_lights,omitted_local_lights,shadow_tiles,draw_calls,gpu_bytes,"
|
"submitted_local_lights,omitted_local_lights,shadow_tiles,draw_calls,gpu_bytes,"
|
||||||
"gpu_main_raster_ms,gpu_shadow_ms,gpu_ms,cpu_ms,readback_cpu_ms\n";
|
"gpu_main_raster_ms,gpu_post_raster_ms,gpu_post_visible,visibility_counters_valid,"
|
||||||
|
"gpu_shadow_ms,gpu_ms,cpu_ms,readback_cpu_ms\n";
|
||||||
csv << std::fixed << std::setprecision(6);
|
csv << std::fixed << std::setprecision(6);
|
||||||
for (unsigned frame = 0; frame < options.frames; ++frame) {
|
for (unsigned frame = 0; frame < options.frames; ++frame) {
|
||||||
renderer.render(scene);
|
renderer.render(scene);
|
||||||
@@ -187,7 +189,8 @@ void benchmark(const Options& options) {
|
|||||||
throw std::runtime_error("GPU raster or frame timestamp was unavailable");
|
throw std::runtime_error("GPU raster or frame timestamp was unavailable");
|
||||||
csv << options.lights << ',' << (options.shadows ? "on" : "off") << ','
|
csv << options.lights << ',' << (options.shadows ? "on" : "off") << ','
|
||||||
<< mode_name(options.visibility) << ',' << mode_name(stats.effective_visibility_mode)
|
<< mode_name(options.visibility) << ',' << mode_name(stats.effective_visibility_mode)
|
||||||
<< ",forward," << options.run_index << ',' << frame << ',';
|
<< ",forward," << FASET_BENCHMARK_CONFIGURATION << ','
|
||||||
|
<< options.run_index << ',' << frame << ',';
|
||||||
csv_text(csv, stats.device);
|
csv_text(csv, stats.device);
|
||||||
csv << ',';
|
csv << ',';
|
||||||
csv_text(csv, options.driver);
|
csv_text(csv, options.driver);
|
||||||
@@ -197,13 +200,15 @@ void benchmark(const Options& options) {
|
|||||||
<< (stats.validation_enabled ? 1 : 0) << ',' << stats.validation_errors << ','
|
<< (stats.validation_enabled ? 1 : 0) << ',' << stats.validation_errors << ','
|
||||||
<< stats.submitted_local_lights << ',' << stats.omitted_local_lights
|
<< stats.submitted_local_lights << ',' << stats.omitted_local_lights
|
||||||
<< ",0," << stats.draw_calls << ',' << stats.gpu_allocated_bytes << ','
|
<< ",0," << stats.draw_calls << ',' << stats.gpu_allocated_bytes << ','
|
||||||
<< stats.gpu_main_raster_ms << ",0," << stats.gpu_ms << ','
|
<< stats.gpu_main_raster_ms << ',' << stats.gpu_post_raster_ms << ','
|
||||||
|
<< stats.gpu_post_visible << ',' << (stats.visibility_counters_valid ? 1 : 0)
|
||||||
|
<< ",0," << stats.gpu_ms << ','
|
||||||
<< stats.cpu_ms << ',' << stats.readback_cpu_ms << '\n';
|
<< stats.cpu_ms << ',' << stats.readback_cpu_ms << '\n';
|
||||||
}
|
}
|
||||||
if (!csv)
|
if (!csv)
|
||||||
throw std::runtime_error("Cannot finish benchmark CSV: " + options.csv.string());
|
throw std::runtime_error("Cannot finish benchmark CSV: " + faset::path_to_utf8(options.csv));
|
||||||
if (!options.capture.empty())
|
if (!options.capture.empty())
|
||||||
renderer.capture(options.capture);
|
renderer.capture(faset::native_io_path(options.capture));
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ def real_executable_smoke(executable: Path) -> None:
|
|||||||
if declared["lights"] != [0, 4, 16, 32, 64, 128] or len(declared["visibility"]) != 3:
|
if declared["lights"] != [0, 4, 16, 32, 64, 128] or len(declared["visibility"]) != 3:
|
||||||
raise AssertionError("C++ executable and Python sweep matrix disagree")
|
raise AssertionError("C++ executable and Python sweep matrix disagree")
|
||||||
with tempfile.TemporaryDirectory() as directory:
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
output = Path(directory) / "smoke.csv"
|
output = Path(directory) / "café 世界" / "smoke.csv"
|
||||||
subprocess.run([executable, "--lights", "4", "--shadows", "off",
|
subprocess.run([executable, "--lights", "4", "--shadows", "off",
|
||||||
"--visibility", "direct", "--width", "64", "--height", "64",
|
"--visibility", "direct", "--width", "64", "--height", "64",
|
||||||
"--warmup", "0", "--frames", "1", "--validation", "on",
|
"--warmup", "0", "--frames", "1", "--validation", "on",
|
||||||
|
|||||||
Reference in New Issue
Block a user