Skip to content

Commit

Permalink
Apply clang-tidy fixes to .../gpu/model.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 588743498
  • Loading branch information
jreiffers authored and copybara-github committed Dec 7, 2023
1 parent 123ee24 commit 6bcdd3a
Show file tree
Hide file tree
Showing 16 changed files with 94 additions and 13 deletions.
44 changes: 38 additions & 6 deletions xla/service/gpu/model/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ cc_library(
"//xla/service:latency_hiding_scheduler",
"//xla/stream_executor:device_description",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/log",
"@com_google_absl//absl/time",
"@tsl//tsl/platform:status",
],
)

Expand All @@ -50,11 +52,9 @@ xla_test(
deps = [
":analytical_latency_estimator",
"//xla:shape_util",
"//xla:statusor",
"//xla/hlo/ir:hlo",
"//xla/hlo/utils:hlo_matchers",
"//xla/service:hlo_cost_analysis",
"//xla/service:hlo_module_config",
"//xla/service:hlo_parser",
"//xla/service:latency_hiding_scheduler",
"//xla/service/gpu/tests:gpu_codegen_test",
"//xla/stream_executor:device_description",
Expand Down Expand Up @@ -90,6 +90,9 @@ xla_cc_test(
"//xla/stream_executor:device_description",
"//xla/tests:hlo_test_base",
"//xla/tests:xla_internal_test_main",
"@com_google_absl//absl/strings:string_view",
"@com_google_googletest//:gtest",
"@tsl//tsl/platform:statusor",
],
)

Expand All @@ -107,7 +110,6 @@ cc_library(
"//xla/service:hlo_pass",
"//xla/stream_executor:device_description",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/log",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@tsl//tsl/platform:status",
Expand All @@ -121,14 +123,15 @@ xla_cc_test(
":gpu_cost_model_stats_collection",
":gpu_hlo_cost_analysis",
"//xla:shape_util",
"//xla/hlo/ir:hlo",
"//xla/service:hlo_cost_analysis",
"//xla/service/gpu:backend_configs_cc",
"//xla/service/gpu:gpu_device_info_for_tests",
"//xla/tests:hlo_test_base",
"//xla/tests:verified_hlo_module",
"//xla/tests:xla_internal_test_main",
"@com_google_absl//absl/status:statusor",
"@tsl//tsl/lib/core:status_test_util",
"@com_google_googletest//:gtest",
"@tsl//tsl/platform:statusor",
],
)

Expand All @@ -143,6 +146,7 @@ cc_library(
deps = [
":hlo_op_profile_proto_cc",
"//xla:shape_util",
"//xla:status",
"//xla:util",
"//xla/hlo/ir:hlo",
"//xla/service:collective_ops_utils",
Expand All @@ -152,8 +156,13 @@ cc_library(
"//xla/service/gpu:backend_configs_cc",
"//xla/service/gpu:cublas_cudnn",
"//xla/stream_executor:device_description",
"@com_google_absl//absl/algorithm:container",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
"@tsl//tsl/platform:errors",
"@tsl//tsl/platform:statusor",
],
)

Expand All @@ -162,8 +171,13 @@ xla_cc_test(
srcs = ["gpu_hlo_cost_analysis_test.cc"],
deps = [
":gpu_hlo_cost_analysis",
"//xla:shape_util",
"//xla/service:hlo_cost_analysis",
"//xla/tests:hlo_test_base",
"//xla/tests:xla_internal_test_main",
"@com_google_absl//absl/strings:string_view",
"@com_google_googletest//:gtest",
"@tsl//tsl/platform:statusor",
],
)

Expand All @@ -176,16 +190,24 @@ cc_library(
":fusion_analysis_cache",
":gpu_hlo_cost_analysis",
"//xla:shape_util",
"//xla:util",
"//xla/hlo/ir:hlo",
"//xla/service:hlo_dataflow_analysis",
"//xla/service/gpu:backend_configs_cc",
"//xla/service/gpu:gpu_fusible",
"//xla/service/gpu:hlo_fusion_analysis",
"//xla/service/gpu:hlo_traversal",
"//xla/service/gpu:launch_dimensions",
"//xla/stream_executor:device_description",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization",
"@com_google_absl//absl/time",
"@llvm-project//llvm:Support",
"@tsl//tsl/platform:status",
] + if_cuda_is_configured(xla_nvml_deps()),
)

Expand All @@ -196,6 +218,7 @@ xla_cc_test(
":gpu_hlo_cost_analysis",
":gpu_performance_model",
"//xla:shape_util",
"//xla:test_helpers",
"//xla/hlo/ir:hlo",
"//xla/service:hlo_module_config",
"//xla/service/gpu:backend_configs_cc",
Expand All @@ -205,6 +228,9 @@ xla_cc_test(
"//xla/tests:xla_internal_test_main",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/time",
"@com_google_googletest//:gtest",
"@tsl//tsl/platform:errors",
"@tsl//tsl/platform:statusor",
],
)

Expand All @@ -222,6 +248,7 @@ cc_library(
"@com_google_absl//absl/algorithm:container",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:span",
Expand All @@ -237,6 +264,7 @@ xla_cc_test(
srcs = ["tile_analysis_test.cc"],
deps = [
":tile_analysis",
"//xla:status_macros",
"//xla:statusor",
"//xla:test_helpers",
"//xla/hlo/ir:hlo",
Expand Down Expand Up @@ -285,8 +313,11 @@ cc_library(
"//xla/service:interpreter_plugin",
"//xla/stream_executor:device_description",
"//xla/tests:test_utils",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/time",
"@tsl//tsl/platform:errors",
"@tsl//tsl/platform:statusor",
],
)

Expand Down Expand Up @@ -335,6 +366,7 @@ xla_cc_test(
"//xla/hlo/ir:hlo",
"//xla/service:gpu_plugin",
"//xla/tests:hlo_test_base",
"@com_google_googletest//:gtest",
"@tsl//tsl/platform:test_main",
],
)
2 changes: 2 additions & 0 deletions xla/service/gpu/model/analytical_latency_estimator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.
#include <memory>
#include <utility>

#include "absl/log/log.h"
#include "absl/time/time.h"
#include "xla/hlo/ir/hlo_instruction.h"
#include "xla/hlo/ir/hlo_opcode.h"
Expand All @@ -27,6 +28,7 @@ limitations under the License.
#include "xla/service/hlo_cost_analysis.h"
#include "xla/service/latency_hiding_scheduler.h"
#include "xla/stream_executor/device_description.h"
#include "tsl/platform/status.h"

namespace xla {
namespace gpu {
Expand Down
1 change: 1 addition & 0 deletions xla/service/gpu/model/analytical_latency_estimator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ limitations under the License.
#include "xla/service/latency_hiding_scheduler.h"
#include "xla/shape.h"
#include "xla/shape_util.h"
#include "xla/statusor.h"
#include "xla/stream_executor/device_description.h"
#include "tsl/platform/statusor.h"
#include "tsl/platform/test.h"
Expand Down
5 changes: 5 additions & 0 deletions xla/service/gpu/model/fusion_analysis_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ limitations under the License.

#include "xla/service/gpu/model/fusion_analysis_cache.h"

#include <optional>
#include <utility>

#include "absl/synchronization/mutex.h"
#include "xla/hlo/ir/hlo_instruction.h"
#include "xla/service/gpu/hlo_fusion_analysis.h"

namespace xla::gpu {

Expand Down
4 changes: 4 additions & 0 deletions xla/service/gpu/model/fusion_analysis_cache_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ limitations under the License.

#include "xla/service/gpu/model/fusion_analysis_cache.h"

#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "absl/strings/string_view.h"
#include "xla/service/gpu/gpu_device_info_for_tests.h"
#include "xla/service/gpu/hlo_fusion_analysis.h"
#include "xla/service/hlo_parser.h"
#include "xla/stream_executor/device_description.h"
#include "xla/tests/hlo_test_base.h"
#include "tsl/platform/statusor.h"

namespace xla::gpu {
namespace {
Expand Down
1 change: 0 additions & 1 deletion xla/service/gpu/model/gpu_cost_model_stats_collection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ limitations under the License.
#include "xla/service/gpu/model/gpu_cost_model_stats_collection.h"

#include "absl/container/flat_hash_set.h"
#include "absl/log/log.h"
#include "absl/strings/string_view.h"
#include "xla/hlo/ir/hlo_computation.h"
#include "xla/hlo/ir/hlo_instruction.h"
Expand Down
5 changes: 3 additions & 2 deletions xla/service/gpu/model/gpu_cost_model_stats_collection_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ limitations under the License.

#include <memory>

#include "absl/status/statusor.h"
#include <gtest/gtest.h>
#include "xla/hlo/ir/hlo_instruction.h"
#include "xla/service/gpu/backend_configs.pb.h"
#include "xla/service/gpu/gpu_device_info_for_tests.h"
#include "xla/service/gpu/model/gpu_hlo_cost_analysis.h"
Expand All @@ -28,7 +29,7 @@ limitations under the License.
#include "xla/shape_util.h"
#include "xla/tests/hlo_test_base.h"
#include "xla/tests/verified_hlo_module.h"
#include "tsl/lib/core/status_test_util.h"
#include "tsl/platform/statusor.h"

namespace xla {
namespace gpu {
Expand Down
9 changes: 9 additions & 0 deletions xla/service/gpu/model/gpu_hlo_cost_analysis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ limitations under the License.
#include "xla/service/gpu/model/gpu_hlo_cost_analysis.h"

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <memory>
#include <string>
#include <variant>
#include <vector>

#include "absl/algorithm/container.h"
#include "absl/container/flat_hash_map.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "xla/hlo/ir/hlo_casting_utils.h"
Expand All @@ -38,8 +43,12 @@ limitations under the License.
#include "xla/service/gpu/model/hlo_op_profiles.h"
#include "xla/service/hlo_cost_analysis.h"
#include "xla/service/hlo_module_config.h"
#include "xla/shape.h"
#include "xla/shape_util.h"
#include "xla/status.h"
#include "xla/stream_executor/device_description.h"
#include "tsl/platform/errors.h"
#include "tsl/platform/statusor.h"

namespace xla {
namespace gpu {
Expand Down
8 changes: 8 additions & 0 deletions xla/service/gpu/model/gpu_hlo_cost_analysis_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ limitations under the License.

#include "xla/service/gpu/model/gpu_hlo_cost_analysis.h"

#include <cstdint>

#include <gtest/gtest.h>
#include "absl/strings/string_view.h"
#include "xla/service/hlo_cost_analysis.h"
#include "xla/shape.h"
#include "xla/shape_util.h"
#include "xla/tests/hlo_test_base.h"
#include "tsl/platform/statusor.h"

namespace xla {
namespace gpu {
Expand Down
11 changes: 10 additions & 1 deletion xla/service/gpu/model/gpu_performance_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ limitations under the License.
#include <cstdint>
#include <cstdlib>
#include <optional>
#include <utility>
#include <vector>

#include "absl/container/flat_hash_set.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/numbers.h"
#include "absl/synchronization/mutex.h"
#include "absl/time/time.h"
#include "llvm/ADT/STLExtras.h"
#include "xla/hlo/ir/hlo_casting_utils.h"
#include "xla/hlo/ir/hlo_instruction.h"
#include "xla/hlo/ir/hlo_instructions.h"
Expand All @@ -33,8 +37,13 @@ limitations under the License.
#include "xla/service/gpu/gpu_fusible.h"
#include "xla/service/gpu/hlo_fusion_analysis.h"
#include "xla/service/gpu/hlo_traversal.h"
#include "xla/service/gpu/launch_dimensions.h"
#include "xla/service/gpu/model/gpu_hlo_cost_analysis.h"
#include "xla/service/hlo_dataflow_analysis.h"
#include "xla/shape_util.h"
#include "xla/stream_executor/device_description.h"
#include "xla/util.h"
#include "tsl/platform/status.h"

#if GOOGLE_CUDA
#include "third_party/gpus/cuda/nvml/include/nvml.h"
Expand Down
5 changes: 5 additions & 0 deletions xla/service/gpu/model/gpu_performance_model_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ limitations under the License.
#include <cstdint>
#include <memory>
#include <utility>
#include <vector>

#include <gtest/gtest.h>
#include "absl/strings/string_view.h"
#include "absl/time/time.h"
#include "xla/hlo/ir/hlo_computation.h"
Expand All @@ -32,7 +34,10 @@ limitations under the License.
#include "xla/shape.h"
#include "xla/shape_util.h"
#include "xla/stream_executor/device_description.h"
#include "xla/test_helpers.h"
#include "xla/tests/hlo_test_base.h"
#include "tsl/platform/errors.h"
#include "tsl/platform/statusor.h"

namespace xla {
namespace gpu {
Expand Down
5 changes: 3 additions & 2 deletions xla/service/gpu/model/hlo_op_profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ limitations under the License.

#include "xla/service/gpu/model/hlo_op_profiler.h"

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <random>
#include <string>
#include <utility>
#include <vector>

#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#include "xla/debug_options_flags.h"
Expand All @@ -43,6 +43,7 @@ limitations under the License.
#include "xla/util.h"
#include "xla/xla_data.pb.h"
#include "tsl/platform/errors.h"
#include "tsl/platform/statusor.h"

#ifdef GOOGLE_CUDA
#include "xla/backends/profiler/gpu/cupti_collector.h"
Expand Down
2 changes: 1 addition & 1 deletion xla/service/gpu/model/hlo_op_profiler_run.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ int RunProfiler(int argc, char** argv) {
}
}

VLOG(1) << "\n" << instr_profiles.DebugString();
VLOG(1) << "\n" << instr_profiles;

DeviceHloInstructionProfiles device_profiles;
device_profiles.mutable_entries()->insert({dev_info.name(), instr_profiles});
Expand Down
1 change: 1 addition & 0 deletions xla/service/gpu/model/hlo_op_profiler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License.

#include "xla/service/gpu/model/hlo_op_profiler.h"

#include <gtest/gtest.h>
#include "xla/hlo/ir/hlo_opcode.h"
#include "xla/tests/hlo_test_base.h"

Expand Down
Loading

0 comments on commit 6bcdd3a

Please sign in to comment.