| # Copyright 2024 The IREE Authors | |
| # | |
| # Licensed under the Apache License v2.0 with LLVM Exceptions. | |
| # See https://llvm.org/LICENSE.txt for license information. | |
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |
| load("//build_tools/bazel:build_defs.oss.bzl", "iree_cmake_extra_content") | |
| load("//build_tools/bazel:iree_lit_test.bzl", "iree_lit_test_suite") | |
| load("//build_tools/embed_data:build_defs.bzl", "iree_c_embed_data") | |
| package( | |
| default_visibility = ["//visibility:public"], | |
| features = ["layering_check"], | |
| licenses = ["notice"], # Apache 2.0 | |
| ) | |
| iree_cmake_extra_content( | |
| content = """ | |
| if(NOT IREE_TARGET_BACKEND_ROCM) | |
| return() | |
| endif() | |
| """, | |
| inline = True, | |
| ) | |
| # Target archs for tuning specs. https://llvm.org/docs/AMDGPUUsage.html#processors | |
| gpu_archs = [ | |
| "gfx942", | |
| ] | |
| tuning_spec_mlir_files = [ | |
| "iree_default_tuning_spec_%s.mlir" % gpu_arch | |
| for gpu_arch in gpu_archs | |
| ] | |
| iree_c_embed_data( | |
| name = "iree_default_tuning_specs_amdgpu", | |
| srcs = tuning_spec_mlir_files, | |
| c_file_output = "iree_default_tuning_specs_amdgpu.c", | |
| flatten = True, | |
| h_file_output = "iree_default_tuning_specs_amdgpu.h", | |
| ) | |
| # Verify that the tuning specs are valid. We need this here because we do not | |
| # assemble the tuning spec mlir and invalid specs do not lead to build errors. | |
| iree_lit_test_suite( | |
| name = "verify_default_tuning_specs_amdgpu", | |
| srcs = tuning_spec_mlir_files, | |
| cfg = "//compiler:lit.cfg.py", | |
| tools = [ | |
| "//tools:iree-opt", | |
| ], | |
| ) |