tvm
Loading...
Searching...
No Matches
layout.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
23#ifndef TVM_TIRX_LAYOUT_H_
24#define TVM_TIRX_LAYOUT_H_
25
26#include <tvm/ffi/container/array.h>
27#include <tvm/ffi/container/tuple.h>
28#include <tvm/ffi/function.h>
29#include <tvm/ffi/object.h>
31#include <tvm/ir/module.h>
32#include <tvm/tirx/exec_scope.h>
33#include <tvm/tirx/var.h>
34
35namespace tvm {
36
37// Forward declaration
38template <typename, typename>
39class AttrRegistry;
40
41namespace tirx {
42template <typename>
43class AxisAttrMap;
44
45class Layout;
46class TileLayout;
47class Iter;
48using ffi::Array;
49using ffi::Tuple;
50
51// Base class for layout
52class LayoutNode : public ffi::Object {
53 public:
55 virtual bool CompatibleWithShape(const ffi::Array<PrimExpr>& shape) const = 0;
56
58 virtual bool VerifyWellFormed() const = 0;
59
61 virtual PrimExpr GetSize(ffi::Optional<ffi::String> axis_name = std::nullopt) const = 0;
62
64 virtual PrimExpr GetSpan(ffi::Optional<ffi::String> axis_name = std::nullopt) const = 0;
65
67 virtual ffi::Map<ffi::String, PrimExpr> Apply(ffi::Array<PrimExpr> coord) const = 0;
68 virtual ffi::Map<ffi::String, PrimExpr> Apply(PrimExpr coord) const = 0;
69 virtual ffi::Map<ffi::String, PrimExpr> Apply(const ffi::Array<PrimExpr>& coord,
70 const ffi::Array<PrimExpr>& shape) const;
71
73 virtual Layout Canonicalize() const = 0;
74
76 virtual Layout Tile(const TileLayout& outer, const ffi::Array<PrimExpr>& outer_shape,
77 const ffi::Array<PrimExpr>& inner_shape) const = 0;
78
80 virtual ffi::Optional<Layout> Slice(const ffi::Array<PrimExpr>& shape,
81 const Region& region) const = 0;
82
87 virtual Layout DirectSum(const TileLayout& left, const ffi::Array<PrimExpr>& left_shape,
88 const ffi::Array<PrimExpr>& right_shape) const = 0;
89
97 virtual ffi::Optional<TileLayout> IsTileInner(const Layout& tile_layout,
98 const ffi::Array<PrimExpr>& tiled_shape,
99 const ffi::Array<PrimExpr>& inner_shape) const = 0;
100
108 virtual ffi::Optional<Layout> IsTileOuter(const Layout& tile_layout,
109 const ffi::Array<PrimExpr>& tiled_shape,
110 const ffi::Array<PrimExpr>& outer_shape) const = 0;
111
118 virtual ffi::Optional<TileLayout> IsDirectSumRight(
119 const Layout& sum_layout, const ffi::Array<PrimExpr>& interleaved_shape,
120 const ffi::Array<PrimExpr>& right_shape) const = 0;
121
128 virtual ffi::Optional<Layout> IsDirectSumLeft(const Layout& sum_layout,
129 const ffi::Array<PrimExpr>& interleaved_shape,
130 const ffi::Array<PrimExpr>& left_shape) const = 0;
131
133 TVM_FFI_DECLARE_OBJECT_INFO("tirx.Layout", LayoutNode, ffi::Object);
134};
135
136class Layout : public ffi::ObjectRef {
137 public:
139};
140
141// target, subscope, scope, iter -> fused_iter
142using FAxisFuser = ffi::TypedFunction<ffi::Optional<Iter>(Target, ffi::String, ffi::String, Iter)>;
143// target, scope, iter -> (outer_iter, inner_iter)
144// Note(@bohao): use ffi::Array<Iter, void> to avoid incomplete type error (SFINAE)
145using FAxisSplitter = ffi::TypedFunction<ffi::Array<Iter, void>(Target, ffi::String, Iter)>;
146
147// Axis
148class AxisNode : public ffi::Object {
149 public:
150 ffi::String name;
151
152 static void RegisterReflection() {
153 namespace refl = tvm::ffi::reflection;
154 refl::ObjectDef<AxisNode>().def_ro("name", &AxisNode::name);
155 }
156
158 bool IsThreadAxis() const;
159
161 bool IsMemoryAxis() const;
162
164 ffi::Optional<ExecScope> GetScope() const;
165
167 ffi::Optional<ExecScope> GetSubscope() const;
168
170 ffi::Optional<FAxisFuser> GetFuser() const;
171
173 ffi::Optional<FAxisSplitter> GetSplitter() const;
174
176 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.Axis", AxisNode, ffi::Object);
177
178 private:
179 // Iternals necessary for AttrRegistry
180 template <typename>
182 template <typename, typename>
183 friend class tvm::AttrRegistry;
184 friend class AxisRegEntry;
186 uint32_t index_{0};
188 uint32_t AttrRegistryIndex() const { return index_; }
190 ffi::String AttrRegistryName() const { return name; }
191};
192
193class Axis : public ffi::ObjectRef {
194 public:
195 Axis() = default;
196
198 TVM_DLL static Axis Get(const ffi::String& name);
199
201 template <typename ValueType>
202 inline static AxisAttrMap<ValueType> GetAttrMap(const ffi::String& attr_name);
203
204 explicit Axis(ffi::ObjectPtr<AxisNode> data) : ObjectRef(ffi::UnsafeInit{}) {
205 TVM_FFI_ICHECK(data != nullptr);
206 data_ = std::move(data);
207 }
208
210
211 private:
212 // Internals necessary for AttrRegistry
213 template <typename, typename>
214 friend class tvm::AttrRegistry;
215 friend class AxisRegEntry;
216};
217
218// AxisRegistry
220 public:
222 TVM_DLL static ffi::Array<ffi::String> ListAxisNames();
223
225 TVM_DLL static AxisRegEntry& RegisterOrGet(const ffi::String& name);
226
228 template <typename ValueType>
229 inline AxisRegEntry& set_attr(const ffi::String& attr_name, const ValueType& value,
230 int plevel = 10);
231
233 inline AxisRegEntry& set_scope(const ffi::String& scope_name, int plevel = 10);
234
236 inline AxisRegEntry& set_subscope(const ffi::String& subscope_name, int plevel = 10);
237
240
243
244 private:
245 // return internal pointer to op.
246 inline AxisNode* get();
247 TVM_DLL void UpdateAttr(const ffi::String& key, ffi::Any value, int plevel);
248
249 // Internals necessary for AttrRegistry
250 Axis axis_;
251 ffi::String name;
252 explicit AxisRegEntry(uint32_t index);
253 template <typename, typename>
254 friend class tvm::AttrRegistry;
255 friend class Axis;
256};
257
259
260// AxisAttrffi::Map
261template <typename ValueType>
262class AxisAttrMap : public AttrRegistryMap<Axis, ValueType> {
263 public:
265 using TParent::count;
266 using TParent::get;
267 using TParent::operator[];
268
269 private:
270 friend class Axis;
272};
273
274// Helper macro for token concatenation
275#ifndef TVM_STR_CONCAT
276#define TVM_STR_CONCAT_(__x, __y) __x##__y
277#define TVM_STR_CONCAT(__x, __y) TVM_STR_CONCAT_(__x, __y)
278#endif
279
280// Define a macro to register the axis entry.
281#define TVM_AXIS_REGISTER_VAR_DEF [[maybe_unused]] static ::tvm::tirx::AxisRegEntry& __make_##Axis
282
283#define TVM_REGISTER_AXIS(AxisName) \
284 TVM_STR_CONCAT(TVM_AXIS_REGISTER_VAR_DEF, __COUNTER__) = \
285 ::tvm::tirx::AxisRegEntry::RegisterOrGet(AxisName)
286
287class IterNode : public ffi::Object {
288 public:
292
293 static void RegisterReflection() {
294 namespace refl = tvm::ffi::reflection;
295 refl::ObjectDef<IterNode>()
296 .def_ro("extent", &IterNode::extent)
297 .def_ro("stride", &IterNode::stride)
298 .def_ro("axis", &IterNode::axis);
299 }
300
302 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.Iter", IterNode, ffi::Object);
303};
304
305class Iter : public ffi::ObjectRef {
306 public:
307 TVM_DLL explicit Iter(PrimExpr extent, PrimExpr stride, Axis axis);
309};
310
312 public:
313 ffi::Array<Iter> shard;
314 ffi::Array<Iter> replica;
315 ffi::Map<Axis, PrimExpr> offset;
316
317 static void RegisterReflection() {
318 namespace refl = tvm::ffi::reflection;
319 refl::ObjectDef<TileLayoutNode>()
320 .def_ro("shard", &TileLayoutNode::shard)
321 .def_ro("replica", &TileLayoutNode::replica)
322 .def_ro("offset", &TileLayoutNode::offset);
323 }
324
326 bool CompatibleWithShape(const ffi::Array<PrimExpr>& shape) const final;
327
330
333
336
338 ffi::Map<ffi::String, PrimExpr> Apply(ffi::Array<PrimExpr> coord) const final;
344 ffi::Map<ffi::String, PrimExpr> Apply(const ffi::Array<PrimExpr>& coord,
345 const ffi::Array<PrimExpr>& shape) const final;
346
349
352 const ffi::Array<PrimExpr>& inner_shape) const final;
353
355 const ffi::Array<PrimExpr>& right_shape) const final;
356
359 const ffi::Array<PrimExpr>& tiled_shape,
360 const ffi::Array<PrimExpr>& inner_shape) const final;
361
364 const ffi::Array<PrimExpr>& tiled_shape,
365 const ffi::Array<PrimExpr>& outer_shape) const final;
366
368 const ffi::Array<PrimExpr>& interleaved_shape,
369 const ffi::Array<PrimExpr>& right_shape) const final;
370
372 const ffi::Array<PrimExpr>& interleaved_shape,
373 const ffi::Array<PrimExpr>& left_shape) const final;
374
377
379 ffi::Optional<Layout> Slice(const ffi::Array<PrimExpr>& shape, const Region& region) const final;
380
383
386
389
392
395
398
400};
401
410
411// ComposeLayout
413 public:
419 // Cached swizzle masks: inner_mask = (1 << swizzle_len) - 1;
420 // outer_mask = inner_mask << atom_len. Set by the ComposeLayout ctor.
423
424 static void RegisterReflection() {
425 namespace refl = tvm::ffi::reflection;
426 refl::ObjectDef<ComposeLayoutNode>()
427 .def_ro("per_element", &ComposeLayoutNode::per_element)
428 .def_ro("swizzle_len", &ComposeLayoutNode::swizzle_len)
429 .def_ro("atom_len", &ComposeLayoutNode::atom_len)
430 .def_ro("swizzle_inner", &ComposeLayoutNode::swizzle_inner)
431 .def_ro("inner_mask", &ComposeLayoutNode::inner_mask)
432 .def_ro("outer_mask", &ComposeLayoutNode::outer_mask)
433 .def_ro("tile_layout", &ComposeLayoutNode::tile_layout);
434 }
435
437 bool CompatibleWithShape(const ffi::Array<PrimExpr>& shape) const final;
438
441
443 PrimExpr GetSize(ffi::Optional<ffi::String> axis_name = std::nullopt) const final;
444
446 PrimExpr GetSpan(ffi::Optional<ffi::String> axis_name = std::nullopt) const final;
447
449 ffi::Map<ffi::String, PrimExpr> Apply(ffi::Array<PrimExpr> coord) const final;
451 ffi::Map<ffi::String, PrimExpr> Apply(const ffi::Array<PrimExpr>& coord,
452 const ffi::Array<PrimExpr>& shape) const final;
453
455 Layout Canonicalize() const final;
456
459 const ffi::Array<PrimExpr>& inner_shape) const final;
460
461 Layout DirectSum(const TileLayout& left, const ffi::Array<PrimExpr>& left_shape,
462 const ffi::Array<PrimExpr>& right_shape) const final;
463
465 ffi::Optional<TileLayout> IsTileInner(const Layout& tile_layout,
466 const ffi::Array<PrimExpr>& tiled_shape,
467 const ffi::Array<PrimExpr>& inner_shape) const final;
468
470 ffi::Optional<Layout> IsTileOuter(const Layout& tile_layout,
471 const ffi::Array<PrimExpr>& tiled_shape,
472 const ffi::Array<PrimExpr>& outer_shape) const final;
473
474 ffi::Optional<TileLayout> IsDirectSumRight(const Layout& sum_layout,
475 const ffi::Array<PrimExpr>& interleaved_shape,
476 const ffi::Array<PrimExpr>& right_shape) const final;
477
478 ffi::Optional<Layout> IsDirectSumLeft(const Layout& sum_layout,
479 const ffi::Array<PrimExpr>& interleaved_shape,
480 const ffi::Array<PrimExpr>& left_shape) const final;
481
483 ffi::Optional<Layout> Slice(const ffi::Array<PrimExpr>& shape, const Region& region) const final;
484
485 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.ComposeLayout", ComposeLayoutNode, LayoutNode);
486};
487
489 public:
490 TVM_DLL explicit ComposeLayout(int per_element, int swizzle_len, int atom_len,
491 TileLayout tile_layout, bool swizzle_inner = true);
492
495};
496
497constexpr int kPSUMMaxElemPerBank = 512;
498constexpr int kPSUMBankNum = 8;
499
500} // namespace tirx
501} // namespace tvm
502
503#endif // TVM_TIRX_LAYOUT_H_
Attribute map used in registry.
Generic attribute map.
Definition attr_registry_map.h:38
ffi::Map<Key, ValueType> used to store meta-data.
Definition attr_registry_map.h:105
ValueType get(const Axis &key, ValueType def_value) const
get the corresponding value element at key with default value.
Definition attr_registry_map.h:136
int count(const Axis &key) const
Check if the map has op as key.
Definition attr_registry_map.h:117
Definition instruction.h:31
Typed reference/view over any Expr whose ExprNode::ty is PrimType.
Definition base_expr.h:401
Managed reference class to TargetNode.
Definition target.h:134
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
Definition layout.h:262
Definition layout.h:148
bool IsThreadAxis() const
Check if the axis is a thread axis.
ffi::Optional< FAxisSplitter > GetSplitter() const
Get the splitter of the (thread) axis.
ffi::Optional< ExecScope > GetScope() const
Get the scope of the (thread) axis.
bool IsMemoryAxis() const
Check if the axis is a memory axis.
ffi::Optional< ExecScope > GetSubscope() const
Get the subscope of the (thread) axis.
ffi::String name
Definition layout.h:150
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.Axis", AxisNode, ffi::Object)
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition layout.h:175
ffi::Optional< FAxisFuser > GetFuser() const
Get the fuser of the (thread) axis.
static void RegisterReflection()
Definition layout.h:152
Definition layout.h:219
AxisRegEntry & set_attr(const ffi::String &attr_name, const ValueType &value, int plevel=10)
Set the attribute for the axis.
AxisRegEntry & set_scope(const ffi::String &scope_name, int plevel=10)
Set the scope of the axis.
AxisRegEntry & set_fuser(const FAxisFuser &fuser)
Set the fuser of the axis.
static ffi::Array< ffi::String > ListAxisNames()
List all axis names.
AxisRegEntry & set_subscope(const ffi::String &subscope_name, int plevel=10)
Set the subscope of the axis.
static AxisRegEntry & RegisterOrGet(const ffi::String &name)
Register or get the axis entry by name.
AxisRegEntry & set_splitter(const FAxisSplitter &splitter)
Set the splitter of the axis.
Definition layout.h:193
static AxisAttrMap< ValueType > GetAttrMap(const ffi::String &attr_name)
Get the attribute map for the axis.
Axis(ffi::ObjectPtr< AxisNode > data)
Definition layout.h:204
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Axis, ffi::ObjectRef, AxisNode)
static Axis Get(const ffi::String &name)
Get the axis object by name.
Axis()=default
Definition layout.h:412
int atom_len
Definition layout.h:416
int swizzle_len
Definition layout.h:415
int inner_mask
Definition layout.h:421
TileLayout tile_layout
Definition layout.h:418
bool CompatibleWithShape(const ffi::Array< PrimExpr > &shape) const final
Check if the layout is compatible with the shape.
bool swizzle_inner
Definition layout.h:417
int outer_mask
Definition layout.h:422
static void RegisterReflection()
Definition layout.h:424
bool VerifyWellFormed() const final
Verify if the layout is well-formed.
int per_element
Definition layout.h:414
Definition layout.h:488
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(ComposeLayout, Layout, ComposeLayoutNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(ComposeLayoutNode)
ComposeLayout(int per_element, int swizzle_len, int atom_len, TileLayout tile_layout, bool swizzle_inner=true)
Definition exec_scope.h:228
Definition layout.h:287
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition layout.h:301
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.Iter", IterNode, ffi::Object)
Axis axis
Definition layout.h:291
PrimExpr extent
Definition layout.h:289
PrimExpr stride
Definition layout.h:290
static void RegisterReflection()
Definition layout.h:293
Definition layout.h:305
Iter(PrimExpr extent, PrimExpr stride, Axis axis)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(Iter, ffi::ObjectRef, IterNode)
Definition layout.h:52
virtual PrimExpr GetSpan(ffi::Optional< ffi::String > axis_name=std::nullopt) const =0
Get the span of the layout (of some axis)
TVM_FFI_DECLARE_OBJECT_INFO("tirx.Layout", LayoutNode, ffi::Object)
virtual ffi::Optional< Layout > Slice(const ffi::Array< PrimExpr > &shape, const Region &region) const =0
Slice the layout with a given shape and region.
virtual bool VerifyWellFormed() const =0
Verify if the layout is well-formed.
virtual ffi::Optional< Layout > IsTileOuter(const Layout &tile_layout, const ffi::Array< PrimExpr > &tiled_shape, const ffi::Array< PrimExpr > &outer_shape) const =0
Check if the layout is the outer layout of a tiled layout.
virtual ffi::Optional< Layout > IsDirectSumLeft(const Layout &sum_layout, const ffi::Array< PrimExpr > &interleaved_shape, const ffi::Array< PrimExpr > &left_shape) const =0
Check if this layout is the left addend A in a direct-sum A + B over the interleaved domain S_A \otim...
virtual PrimExpr GetSize(ffi::Optional< ffi::String > axis_name=std::nullopt) const =0
Get the size of the layout (of some axis)
virtual Layout Canonicalize() const =0
Turn the layout to canonical form.
virtual Layout DirectSum(const TileLayout &left, const ffi::Array< PrimExpr > &left_shape, const ffi::Array< PrimExpr > &right_shape) const =0
Direct-sum on the tiling domain (unscaled composition) Given left layout A (grouped by left_shape) an...
virtual ffi::Map< ffi::String, PrimExpr > Apply(PrimExpr coord) const =0
virtual bool CompatibleWithShape(const ffi::Array< PrimExpr > &shape) const =0
Compatible with shape.
virtual ffi::Map< ffi::String, PrimExpr > Apply(ffi::Array< PrimExpr > coord) const =0
Apply layout on the input coordinate and get the mapped output.
virtual Layout Tile(const TileLayout &outer, const ffi::Array< PrimExpr > &outer_shape, const ffi::Array< PrimExpr > &inner_shape) const =0
Tile the current layout with a given layout.
virtual ffi::Map< ffi::String, PrimExpr > Apply(const ffi::Array< PrimExpr > &coord, const ffi::Array< PrimExpr > &shape) const
virtual ffi::Optional< TileLayout > IsTileInner(const Layout &tile_layout, const ffi::Array< PrimExpr > &tiled_shape, const ffi::Array< PrimExpr > &inner_shape) const =0
Check if the layout is the inner layout of a tiled layout.
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition layout.h:132
virtual ffi::Optional< TileLayout > IsDirectSumRight(const Layout &sum_layout, const ffi::Array< PrimExpr > &interleaved_shape, const ffi::Array< PrimExpr > &right_shape) const =0
Check if this layout is the right addend B in a direct-sum A + B over the interleaved domain S_A \oti...
Definition layout.h:136
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(Layout, ffi::ObjectRef, LayoutNode)
Definition layout.h:311
ffi::Map< Axis, PrimExpr > offset
Definition layout.h:315
PrimExpr GetSpan(ffi::Optional< ffi::String > axis_name=std::nullopt) const final
Get the span of the layout (of some axis)
PrimExpr GetSize(ffi::Optional< ffi::String > axis_name=std::nullopt) const final
Get the size of the layout (of some axis)
ffi::Optional< Layout > IsTileOuter(const Layout &tile_layout, const ffi::Array< PrimExpr > &tiled_shape, const ffi::Array< PrimExpr > &outer_shape) const final
Check if the layout is the outer layout of a tiled layout.
ffi::Array< Iter > replica
Definition layout.h:314
bool IsTrivial() const
Is the layout trivial (pure memory, identical mapping)
ffi::Map< ffi::String, PrimExpr > Apply(ffi::Array< PrimExpr > coord) const final
Apply the input coordinate and get the mapped output.
ffi::Array< Iter > shard
Definition layout.h:313
ffi::Array< PrimExpr > GetShardShape() const
Get the shape of the shard.
ffi::Optional< Layout > IsDirectSumLeft(const Layout &sum_layout, const ffi::Array< PrimExpr > &interleaved_shape, const ffi::Array< PrimExpr > &left_shape) const final
Check if this layout is the left addend A in a direct-sum A + B over the interleaved domain S_A \otim...
static void RegisterReflection()
Definition layout.h:317
bool VerifyWellFormed() const final
Verify if the layout is well-formed.
ffi::Optional< TileLayout > IsDirectSumRight(const Layout &sum_layout, const ffi::Array< PrimExpr > &interleaved_shape, const ffi::Array< PrimExpr > &right_shape) const final
Check if this layout is the right addend B in a direct-sum A + B over the interleaved domain S_A \oti...
ffi::Optional< TileLayout > IsTileInner(const Layout &tile_layout, const ffi::Array< PrimExpr > &tiled_shape, const ffi::Array< PrimExpr > &inner_shape) const final
Check if the layout is the inner layout of a tiled layout.
bool HasMemoryAxis() const
Has Memory Axis.
Layout Canonicalize() const final
Turn the layout to canonical form.
bool IsTrainium() const
Check if the layout is trainium layout.
Layout DirectSum(const TileLayout &left, const ffi::Array< PrimExpr > &left_shape, const ffi::Array< PrimExpr > &right_shape) const final
Direct-sum on the tiling domain (unscaled composition) Given left layout A (grouped by left_shape) an...
bool HasThreadAxis() const
Has Thread Axis.
static TileLayout DefaultLayout(ffi::Array< PrimExpr > shape)
Get the default layout for the shape.
bool CompatibleWithShape(const ffi::Array< PrimExpr > &shape) const final
Check if the layout is compatible with the shape.
ffi::Optional< Tuple< ExecScope, ExecScope > > GetScope() const
Get the scope pair of the layout.
Layout Tile(const TileLayout &outer, const ffi::Array< PrimExpr > &outer_shape, const ffi::Array< PrimExpr > &inner_shape) const final
Tile the layout with an outer layout.
ffi::Optional< Layout > Slice(const ffi::Array< PrimExpr > &shape, const Region &region) const final
Slice the layout with a given shape and region.
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.TileLayout", TileLayoutNode, LayoutNode)
Definition layout.h:402
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(TileLayout, Layout, TileLayoutNode)
TileLayout(ffi::Array< Iter > shard, ffi::Array< Iter > replica, ffi::Map< Axis, PrimExpr > offset)
TVM_DEFINE_OBJECT_REF_COW_METHOD(TileLayoutNode)
IRModule that holds the functions and type definitions.
ffi::TypedFunction< ffi::Array< Iter, void >(Target, ffi::String, Iter)> FAxisSplitter
Definition layout.h:145
constexpr int kPSUMMaxElemPerBank
Definition layout.h:497
constexpr int kPSUMBankNum
Definition layout.h:498
ffi::Array< Range > Region
Definition var.h:71
ffi::TypedFunction< ffi::Optional< Iter >(Target, ffi::String, ffi::String, Iter)> FAxisFuser
Definition layout.h:142
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40
Variables in the TIR.