dynamic_slice_fusion_test.cc
imports xla/backends/gpu/ffi.himports xla/ffi/ffi.h
SHA-2568bab6dde77efecc4d3391cd4a94dae66148ece4312f3df9b6cf2d036bb0395d3
MaleculeMd₂(In₅Pa)
Evidence
1/* Copyright 2024 The OpenXLA Authors.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is …
11:42… IND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14==============================================================================*/
15
16#include <cstdint>
17#include <memory>
18#include <optional>
19#include <string>
20#include <utility>
21#include <variant>
22#include <vector>
23
24#include <gmock/gmock.h>
25#include "absl/algorithm/container.h"
26#include "absl/log/check.h"
27#include "absl/status/status.h"
28#include "absl/strings/ascii.h"
29#include "xla/backends/gpu/ffi.h"
30#include "xla/backends/gpu/runtime/dynamic_slice_thunk.h"
31#include "xla/backends/gpu/runtime/thunk.h"
32#include "xla/backends/gpu/runtime/thunk_executor.h"
33#include "xla/backends/gpu/runtime/while_thunk.h"
34#include "xla/backends/gpu/transforms/dynamic_slice_fusion_rewriter.h"
35#include "xla/error_spec.h"
36#include "xla/ffi/ffi.h"
37#include "xla/hlo/builder/lib/constants.h"
38#include "xla/hlo/builder/xla_builder.h"
39#include "xla/hlo/ir/hlo_computation.h"
40#include "xla/hlo/ir/hlo_module.h"
41#include "xla/hlo/testlib/filecheck.h"
42#include "xla/service/executable.h"
43#include "xla/service/gpu/gpu_executable.h"
44#include "xla/service/gpu/ir_emission_utils.h"
45#include "xla/service/hlo.pb.h"
46#include "xla/service/hlo_module_config.h"
47#include "xla/service/hlo_runner_interface.h"
48#include "xla/service/platform_util.h"
49#include "xla/shape.h"
50#include "xla/shape_util.h"
51#include "xla/stream_executor/device_address.h"
52#include "xla/stream_executor/platform_manager.h"
53#include "xla/stream_executor/semantic_version.h"
54#include "xla/stream_executor/stream.h"
55#include "xla/stream_executor/stream_executor.h"
56#include "xla/tests/hlo_test_base_legacy.h"
57#include "xla/tsl/platform/errors.h"
58#include "xla/tsl/platform/statusor.h"
258:77… ustom_fusion_config":{"name":"address_computation"}}}
259 })";
260
261 EXPECT_TRUE(RunAndCompareTwoModules(hlo_ref, hlo_opt, error_spec,
262 /*run_hlo_passes=*/false));
263}
264
265TEST …
2189:134… "}}}
2190 })";
2191
2192 // The GEMM custom call does not have a workspace, shouldn't be run in command
2193 // buffer.
2194 EXPECT_TRUE(RunAndCompareTwoModules(
2195 …
3027:44… utations_ref =
3028 GetDynamicSliceFusions(*ref_module_opt);
3029 EXPECT_EQ(address_computations_ref.size(), 0);
3030 ASSERT_EQ(address_computations_opt.size(), 1);
3031
3032 // Check that reduce scatter happens in the fusion in optimized module and not
3033 // outside the fusion.
3034 EXP …