• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef TENSORFLOW_COMPILER_XLA_SERVICE_GPU_TRIANGULAR_SOLVE_THUNK_H_
17 #define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_TRIANGULAR_SOLVE_THUNK_H_
18 
19 #include "absl/types/optional.h"
20 #include "tensorflow/compiler/xla/service/buffer_assignment.h"
21 #include "tensorflow/compiler/xla/service/gpu/buffer_allocations.h"
22 #include "tensorflow/compiler/xla/service/gpu/gpu_executable.h"
23 #include "tensorflow/compiler/xla/service/gpu/hlo_execution_profiler.h"
24 #include "tensorflow/compiler/xla/service/gpu/thunk.h"
25 #include "tensorflow/compiler/xla/service/hlo_instruction.h"
26 #include "tensorflow/compiler/xla/types.h"
27 #include "tensorflow/compiler/xla/xla_data.pb.h"
28 #include "tensorflow/core/lib/core/status.h"
29 #include "tensorflow/core/platform/stream_executor_no_cuda.h"
30 #include "tensorflow/stream_executor/blas.h"
31 
32 namespace xla {
33 namespace gpu {
34 
35 // This class stores everything that StreamExecutor needs to launch a triangular
36 // solve (BlasTrsm). It is generated by IrEmitter.
37 //
38 // Thread-compatible.
39 class TriangularSolveThunk : public Thunk {
40  public:
41   TriangularSolveThunk(ThunkInfo thunk_info,
42                        const TriangularSolveOptions& options,
43                        const BufferAllocation::Slice& a_buffer,
44                        const BufferAllocation::Slice& b_buffer,
45                        PrimitiveType type, int64 batch_size, int64 m, int64 n,
46                        int64 a_batch_stride, int64 b_batch_stride);
47 
48   TriangularSolveThunk(const TriangularSolveThunk&) = delete;
49   TriangularSolveThunk& operator=(const TriangularSolveThunk&) = delete;
50 
51   Status ExecuteOnStream(const ExecuteParams& params) override;
52 
53  private:
54   const se::blas::UpperLower uplo_;
55   const se::blas::Side side_;
56   const se::blas::Diagonal unit_diagonal_;
57   se::blas::Transpose transpose_a_;
58 
59   const BufferAllocation::Slice a_buffer_;
60   const BufferAllocation::Slice b_buffer_;
61 
62   const PrimitiveType type_;
63   const int64 batch_size_;
64   const int64 m_;
65   const int64 n_;
66   const int64 a_batch_stride_;
67   const int64 b_batch_stride_;
68 };
69 
70 }  // namespace gpu
71 }  // namespace xla
72 
73 #endif  // TENSORFLOW_COMPILER_XLA_SERVICE_GPU_TRIANGULAR_SOLVE_THUNK_H_
74