1 /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #include "tensorflow/compiler/xla/service/gpu/gpu_scatter_expander.h" 17 18 #include "absl/algorithm/container.h" 19 #include "tensorflow/compiler/xla/service/hlo_computation.h" 20 #include "tensorflow/compiler/xla/service/hlo_instruction.h" 21 #include "tensorflow/compiler/xla/service/hlo_module.h" 22 #include "tensorflow/compiler/xla/statusor.h" 23 24 namespace xla { 25 InstructionMatchesPattern(HloInstruction * inst)26bool GpuScatterExpander::InstructionMatchesPattern(HloInstruction* inst) { 27 // TODO(b/129698548): Scattering elements larger than 64 bits is not 28 // supported by XLA:GPU. 29 // TODO(b/227486631): Variadic scatter is not yet supported by GPU. 30 return inst->opcode() == HloOpcode::kScatter && 31 (inst->shape().IsTuple() || 32 primitive_util::BitWidth(inst->shape().element_type()) > 64); 33 } 34 35 } // namespace xla 36