Skip to content

Commit

Permalink
gpu: reduce compilation units to improve iteration time by ~288ms
Browse files Browse the repository at this point in the history
See #124

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
  • Loading branch information
emidoots committed Dec 12, 2021
1 parent 51aae5e commit 43ffa1c
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 123 deletions.
131 changes: 8 additions & 123 deletions gpu/build_dawn.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1248,133 +1248,18 @@ fn buildLibAbseilCpp(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
var flags = std.ArrayList([]const u8).init(b.allocator);
options.appendFlags(&flags, false) catch unreachable;
flags.appendSlice(&.{
include("libs/dawn"),
include("libs/dawn/third_party/abseil-cpp"),
}) catch unreachable;

// absl
for ([_][]const u8{
"third_party/abseil-cpp/absl/strings/match.cc",
"third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc",
"third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.cc",
"third_party/abseil-cpp/absl/strings/internal/cordz_info.cc",
"third_party/abseil-cpp/absl/strings/internal/cord_internal.cc",
"third_party/abseil-cpp/absl/strings/internal/cordz_sample_token.cc",
"third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc",
"third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc",
"third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc",
"third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc",
"third_party/abseil-cpp/absl/strings/internal/str_format/output.cc",
"third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc",
"third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc",
"third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc",
"third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc",
"third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc",
"third_party/abseil-cpp/absl/strings/internal/memutil.cc",
"third_party/abseil-cpp/absl/strings/internal/ostringstream.cc",
"third_party/abseil-cpp/absl/strings/internal/pow10_helper.cc",
"third_party/abseil-cpp/absl/strings/internal/utf8.cc",
"third_party/abseil-cpp/absl/strings/internal/cordz_functions.cc",
"third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc",
"third_party/abseil-cpp/absl/strings/internal/escaping.cc",
"third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc",
"third_party/abseil-cpp/absl/strings/string_view.cc",
"third_party/abseil-cpp/absl/strings/str_cat.cc",
"third_party/abseil-cpp/absl/strings/cord.cc",
"third_party/abseil-cpp/absl/strings/ascii.cc",
"third_party/abseil-cpp/absl/strings/numbers.cc",
"third_party/abseil-cpp/absl/strings/charconv.cc",
"third_party/abseil-cpp/absl/strings/str_split.cc",
"third_party/abseil-cpp/absl/strings/substitute.cc",
"third_party/abseil-cpp/absl/strings/escaping.cc",
"third_party/abseil-cpp/absl/strings/str_replace.cc",
"third_party/abseil-cpp/absl/types/bad_any_cast.cc",
"third_party/abseil-cpp/absl/types/bad_optional_access.cc",
"third_party/abseil-cpp/absl/types/bad_variant_access.cc",
"third_party/abseil-cpp/absl/flags/parse.cc",
"third_party/abseil-cpp/absl/flags/usage.cc",
"third_party/abseil-cpp/absl/flags/internal/private_handle_accessor.cc",
"third_party/abseil-cpp/absl/flags/internal/usage.cc",
"third_party/abseil-cpp/absl/flags/internal/program_name.cc",
"third_party/abseil-cpp/absl/flags/internal/flag.cc",
"third_party/abseil-cpp/absl/flags/internal/commandlineflag.cc",
"third_party/abseil-cpp/absl/flags/reflection.cc",
"third_party/abseil-cpp/absl/flags/usage_config.cc",
"third_party/abseil-cpp/absl/flags/flag.cc",
"third_party/abseil-cpp/absl/flags/marshalling.cc",
"third_party/abseil-cpp/absl/flags/commandlineflag.cc",
"third_party/abseil-cpp/absl/synchronization/blocking_counter.cc",
"third_party/abseil-cpp/absl/synchronization/mutex.cc",
"third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc",
"third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc",
"third_party/abseil-cpp/absl/synchronization/internal/waiter.cc",
"third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc",
"third_party/abseil-cpp/absl/synchronization/barrier.cc",
"third_party/abseil-cpp/absl/synchronization/notification.cc",
"third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc",
"third_party/abseil-cpp/absl/hash/internal/hash.cc",
"third_party/abseil-cpp/absl/hash/internal/city.cc",
"third_party/abseil-cpp/absl/debugging/symbolize.cc",
"third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc",
"third_party/abseil-cpp/absl/debugging/leak_check_disable.cc",
"third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc",
"third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc",
"third_party/abseil-cpp/absl/debugging/internal/stack_consumption.cc",
"third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc",
"third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc",
"third_party/abseil-cpp/absl/debugging/internal/demangle.cc",
"third_party/abseil-cpp/absl/debugging/leak_check.cc",
"third_party/abseil-cpp/absl/debugging/stacktrace.cc",
"third_party/abseil-cpp/absl/status/status_payload_printer.cc",
"third_party/abseil-cpp/absl/status/status.cc",
"third_party/abseil-cpp/absl/status/statusor.cc",
"third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc",
"third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc",
"third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc",
"third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc",
"third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc",
"third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc",
"third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc",
"third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc",
"third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc",
"third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc",
"third_party/abseil-cpp/absl/time/clock.cc",
"third_party/abseil-cpp/absl/time/duration.cc",
"third_party/abseil-cpp/absl/time/civil_time.cc",
"third_party/abseil-cpp/absl/time/format.cc",
"third_party/abseil-cpp/absl/time/time.cc",
"third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc",
"third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc",
"third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc",
"third_party/abseil-cpp/absl/numeric/int128.cc",
"third_party/abseil-cpp/absl/random/gaussian_distribution.cc",
"third_party/abseil-cpp/absl/random/discrete_distribution.cc",
"third_party/abseil-cpp/absl/random/seed_gen_exception.cc",
"third_party/abseil-cpp/absl/random/internal/seed_material.cc",
"third_party/abseil-cpp/absl/random/internal/randen_slow.cc",
"third_party/abseil-cpp/absl/random/internal/randen.cc",
"third_party/abseil-cpp/absl/random/internal/randen_detect.cc",
"third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc",
"third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc",
"third_party/abseil-cpp/absl/random/internal/pool_urbg.cc",
"third_party/abseil-cpp/absl/random/seed_sequences.cc",
"third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc",
"third_party/abseil-cpp/absl/base/internal/periodic_sampler.cc",
"third_party/abseil-cpp/absl/base/internal/cycleclock.cc",
"third_party/abseil-cpp/absl/base/internal/spinlock.cc",
"third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc",
"third_party/abseil-cpp/absl/base/internal/scoped_set_env.cc",
"third_party/abseil-cpp/absl/base/internal/sysinfo.cc",
"third_party/abseil-cpp/absl/base/internal/raw_logging.cc",
"third_party/abseil-cpp/absl/base/internal/throw_delegate.cc",
"third_party/abseil-cpp/absl/base/internal/strerror.cc",
"third_party/abseil-cpp/absl/base/internal/thread_identity.cc",
"third_party/abseil-cpp/absl/base/internal/exponential_biased.cc",
"third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc",
"third_party/abseil-cpp/absl/base/log_severity.cc",
}) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
lib.addCSourceFile(abs_path, flags.items);
}
lib.addCSourceFiles(&.{
thisDir() ++ "/src/dawn/sources/abseil.cpp",
thisDir() ++ "/libs/dawn/third_party/abseil-cpp/absl/strings/numbers.cc",
thisDir() ++ "/libs/dawn/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc",
thisDir() ++ "/libs/dawn/third_party/abseil-cpp/absl/time/format.cc",
thisDir() ++ "/libs/dawn/third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc",
}, flags.items);
return lib;
}

Expand Down
114 changes: 114 additions & 0 deletions gpu/src/dawn/sources/abseil.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#include "third_party/abseil-cpp/absl/strings/match.cc"
#include "third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cordz_info.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cord_internal.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cordz_sample_token.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc"
#include "third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc"
#include "third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc"
#include "third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc"
#include "third_party/abseil-cpp/absl/strings/internal/str_format/output.cc"
#include "third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc"
#include "third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc"
#include "third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc"
#include "third_party/abseil-cpp/absl/strings/internal/memutil.cc"
#include "third_party/abseil-cpp/absl/strings/internal/ostringstream.cc"
#include "third_party/abseil-cpp/absl/strings/internal/pow10_helper.cc"
#include "third_party/abseil-cpp/absl/strings/internal/utf8.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cordz_functions.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc"
#include "third_party/abseil-cpp/absl/strings/internal/escaping.cc"
#include "third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc"
#include "third_party/abseil-cpp/absl/strings/string_view.cc"
#include "third_party/abseil-cpp/absl/strings/str_cat.cc"
#include "third_party/abseil-cpp/absl/strings/cord.cc"
#include "third_party/abseil-cpp/absl/strings/ascii.cc"
#include "third_party/abseil-cpp/absl/strings/charconv.cc"
#include "third_party/abseil-cpp/absl/strings/str_split.cc"
#include "third_party/abseil-cpp/absl/strings/substitute.cc"
#include "third_party/abseil-cpp/absl/strings/escaping.cc"
#include "third_party/abseil-cpp/absl/strings/str_replace.cc"
#include "third_party/abseil-cpp/absl/types/bad_any_cast.cc"
#include "third_party/abseil-cpp/absl/types/bad_optional_access.cc"
#include "third_party/abseil-cpp/absl/types/bad_variant_access.cc"
#include "third_party/abseil-cpp/absl/flags/parse.cc"
#include "third_party/abseil-cpp/absl/flags/usage.cc"
#include "third_party/abseil-cpp/absl/flags/internal/private_handle_accessor.cc"
#include "third_party/abseil-cpp/absl/flags/internal/usage.cc"
#include "third_party/abseil-cpp/absl/flags/internal/program_name.cc"
#include "third_party/abseil-cpp/absl/flags/internal/flag.cc"
#include "third_party/abseil-cpp/absl/flags/internal/commandlineflag.cc"
#include "third_party/abseil-cpp/absl/flags/reflection.cc"
#include "third_party/abseil-cpp/absl/flags/usage_config.cc"
#include "third_party/abseil-cpp/absl/flags/flag.cc"
#include "third_party/abseil-cpp/absl/flags/marshalling.cc"
#include "third_party/abseil-cpp/absl/flags/commandlineflag.cc"
#include "third_party/abseil-cpp/absl/synchronization/blocking_counter.cc"
#include "third_party/abseil-cpp/absl/synchronization/mutex.cc"
#include "third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc"
#include "third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc"
#include "third_party/abseil-cpp/absl/synchronization/internal/waiter.cc"
#include "third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc"
#include "third_party/abseil-cpp/absl/synchronization/barrier.cc"
#include "third_party/abseil-cpp/absl/synchronization/notification.cc"
#include "third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc"
#include "third_party/abseil-cpp/absl/hash/internal/hash.cc"
#include "third_party/abseil-cpp/absl/hash/internal/city.cc"
#include "third_party/abseil-cpp/absl/debugging/symbolize.cc"
#include "third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc"
#include "third_party/abseil-cpp/absl/debugging/leak_check_disable.cc"
#include "third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc"
#include "third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc"
#include "third_party/abseil-cpp/absl/debugging/internal/stack_consumption.cc"
#include "third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc"
#include "third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc"
#include "third_party/abseil-cpp/absl/debugging/internal/demangle.cc"
#include "third_party/abseil-cpp/absl/debugging/leak_check.cc"
#include "third_party/abseil-cpp/absl/debugging/stacktrace.cc"
#include "third_party/abseil-cpp/absl/status/status_payload_printer.cc"
#include "third_party/abseil-cpp/absl/status/status.cc"
#include "third_party/abseil-cpp/absl/status/statusor.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc"
#include "third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc"
#include "third_party/abseil-cpp/absl/time/clock.cc"
#include "third_party/abseil-cpp/absl/time/duration.cc"
#include "third_party/abseil-cpp/absl/time/civil_time.cc"
#include "third_party/abseil-cpp/absl/time/time.cc"
#include "third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc"
#include "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc"
#include "third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc"
#include "third_party/abseil-cpp/absl/numeric/int128.cc"
#include "third_party/abseil-cpp/absl/random/gaussian_distribution.cc"
#include "third_party/abseil-cpp/absl/random/discrete_distribution.cc"
#include "third_party/abseil-cpp/absl/random/seed_gen_exception.cc"
#include "third_party/abseil-cpp/absl/random/internal/seed_material.cc"
#include "third_party/abseil-cpp/absl/random/internal/randen_slow.cc"
#include "third_party/abseil-cpp/absl/random/internal/randen.cc"
#include "third_party/abseil-cpp/absl/random/internal/randen_detect.cc"
#include "third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc"
#include "third_party/abseil-cpp/absl/random/internal/pool_urbg.cc"
#include "third_party/abseil-cpp/absl/random/seed_sequences.cc"
#include "third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc"
#include "third_party/abseil-cpp/absl/base/internal/periodic_sampler.cc"
#include "third_party/abseil-cpp/absl/base/internal/cycleclock.cc"
#include "third_party/abseil-cpp/absl/base/internal/spinlock.cc"
#include "third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc"
#include "third_party/abseil-cpp/absl/base/internal/scoped_set_env.cc"
#include "third_party/abseil-cpp/absl/base/internal/sysinfo.cc"
#include "third_party/abseil-cpp/absl/base/internal/raw_logging.cc"
#include "third_party/abseil-cpp/absl/base/internal/throw_delegate.cc"
#include "third_party/abseil-cpp/absl/base/internal/strerror.cc"
#include "third_party/abseil-cpp/absl/base/internal/thread_identity.cc"
#include "third_party/abseil-cpp/absl/base/internal/exponential_biased.cc"
#include "third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc"
#include "third_party/abseil-cpp/absl/base/log_severity.cc"

0 comments on commit 43ffa1c

Please sign in to comment.