Skip to content

Commit 48c6790

Browse files
committed
Fixing misnomers in mesh dialect
- dialect name mesh -> shard - (device) mesh -> (device) grid - spmdize -> partition
1 parent be6bed4 commit 48c6790

File tree

102 files changed

+3542
-3564
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3542
-3564
lines changed
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
# 'mesh' Dialect
1+
# 'shard' Dialect
22

3-
The `mesh` dialect contains a set of attributes, operations and interfaces that
4-
are useful for representing sharding and communication on a device mesh
3+
The `shard` dialect contains a set of attributes, operations and interfaces that
4+
are useful for representing sharding and communication on a device grid
55
cluster.
66

77
[TOC]
88

99
## Collective Communication Operations
10-
There are a number of operations in the Mesh dialect to facilitate
11-
communication between devices in a mesh.
10+
There are a number of operations in the Shard dialect to facilitate
11+
communication between devices in a grid.
1212
It is assumed that the user is familiar with collective operations.
1313
[Wikipedia](https://en.wikipedia.org/wiki/Collective_operation) has a good
1414
explanation.
15-
The main addition is that the collectives in this dialect have mesh
15+
The main addition is that the collectives in this dialect have grid
1616
semantics.
1717

1818
### Device groups
19-
The operation attributes `mesh` and `mesh_axes` specifies a list of device mesh
19+
The operation attributes `grid` and `grid_axes` specifies a list of device grid
2020
axes that partition the devices into disjoint groups.
2121
The collective operation is performed between devices in the same group.
22-
Devices that have the same coordinates outside of axes `mesh_axes` are in the
22+
Devices that have the same coordinates outside of axes `grid_axes` are in the
2323
same group.
24-
A group is described by its multi-index along the axes outside of `mesh_axes`.
25-
For example if we have a device mesh of size `2x3x4x5` and the partition mesh
24+
A group is described by its multi-index along the axes outside of `grid_axes`.
25+
For example if we have a device grid of size `2x3x4x5` and the partition grid
2626
axes list is `[0, 1]` then devices are partitioned into the groups
2727
`{ { (i, j, k, m) | 0<=i<2, 0<=j<3 } | 0<=k<4, 0<=m<5 }`.
2828
The device groups would be `{ (k, m) | 0<=k<4, 0<=m<5 }`.
@@ -31,19 +31,19 @@ Device (1, 0, 2, 4) will be in another group.
3131
Some collective operations like all-to-all and all-gather care about the
3232
order of devices.
3333
The order of device in a device group is induced by the order of axes in
34-
`mesh_axes`.
34+
`grid_axes`.
3535
The axes are ordered from outer to inner.
3636
If we have an axis list `[3, 1]` then device `(i, 1, k, 0)` will precede
3737
both devices `(i, 0, k, 1)` and `(i, 2, k, 0)`.
3838

3939
### In-group Device
4040
Some operations like `broadcast`, `scatter` and `send` specify devices in each
4141
device-group.
42-
These devices are represented with their multi-index over the mesh axes that
42+
These devices are represented with their multi-index over the grid axes that
4343
are not constant within a device group.
44-
These are the axes specified by `mesh_axes` attribute.
44+
These are the axes specified by `grid_axes` attribute.
4545

46-
For Example on a 3D mesh an operation with `mesh_axes = [0, 2]` would specify
46+
For Example on a 3D grid an operation with `grid_axes = [0, 2]` would specify
4747
an in-group device with `(i, j)`. Then for each group with index `g` on the
4848
second axis, the in-group device would be `(i, g, j)`.
4949
### Purity
@@ -60,15 +60,15 @@ For example if a collective operation is optimized out, than it must also
6060
not appear in any path of execution on any process.
6161

6262
Having the operations as `Pure` implies that if an interpreter is to execute
63-
the IR containing the `mesh` collectives, all processes would execute the same
63+
the IR containing the `grid` collectives, all processes would execute the same
6464
line when they reach a pure collective operation.
6565
This requirement stems from the need to be compatible with general optimization
6666
passes like dead code and common sub-expression elimination.
6767

6868
## Operations
6969

70-
[include "Dialects/MeshOps.md"]
70+
[include "Dialects/ShardOps.md"]
7171

7272
## Attributes
7373

74-
[include "Dialects/MeshAttrs.md"]
74+
[include "Dialects/ShardAttrs.md"]

mlir/docs/Passes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ This document describes the available MLIR passes and their contracts.
7272

7373
[include "MemRefPasses.md"]
7474

75-
## 'mesh' Dialect Passes
75+
## 'shard' Dialect Passes
7676

77-
[include "MeshPasses.md"]
77+
[include "ShardPasses.md"]
7878

7979
## 'ml\_program' Dialect Passes
8080

mlir/include/mlir/Conversion/Passes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
#include "mlir/Conversion/MemRefToEmitC/MemRefToEmitCPass.h"
5353
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
5454
#include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h"
55-
#include "mlir/Conversion/MeshToMPI/MeshToMPI.h"
5655
#include "mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h"
5756
#include "mlir/Conversion/NVVMToLLVM/NVVMToLLVM.h"
5857
#include "mlir/Conversion/OpenACCToSCF/ConvertOpenACCToSCF.h"
@@ -66,6 +65,7 @@
6665
#include "mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h"
6766
#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h"
6867
#include "mlir/Conversion/ShapeToStandard/ShapeToStandard.h"
68+
#include "mlir/Conversion/ShardToMPI/ShardToMPI.h"
6969
#include "mlir/Conversion/TensorToLinalg/TensorToLinalgPass.h"
7070
#include "mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h"
7171
#include "mlir/Conversion/TosaToArith/TosaToArith.h"

mlir/include/mlir/Conversion/Passes.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -903,13 +903,13 @@ def ConvertMemRefToSPIRVPass : Pass<"convert-memref-to-spirv"> {
903903
}
904904

905905
//===----------------------------------------------------------------------===//
906-
// MeshToMPI
906+
// ShardToMPI
907907
//===----------------------------------------------------------------------===//
908908

909-
def ConvertMeshToMPIPass : Pass<"convert-mesh-to-mpi"> {
910-
let summary = "Convert Mesh dialect to MPI dialect.";
909+
def ConvertShardToMPIPass : Pass<"convert-shard-to-mpi"> {
910+
let summary = "Convert Shard dialect to MPI dialect.";
911911
let description = [{
912-
This pass converts communication operations from the Mesh dialect to the
912+
This pass converts communication operations from the Shard dialect to the
913913
MPI dialect.
914914
If it finds the DLTI attribute "MPI:comm_world-rank" on the module it will
915915
use that integer value instead of calling MPI_Comm_rank. This allows
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
//===- MeshToMPI.h - Convert Mesh to MPI dialect ----------------*- C++ -*-===//
1+
//===- ShardToMPI.h - Convert Shard to MPI dialect --------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef MLIR_CONVERSION_MESHTOMPI_MESHTOMPI_H
10-
#define MLIR_CONVERSION_MESHTOMPI_MESHTOMPI_H
9+
#ifndef MLIR_CONVERSION_SHARDTOMPI_SHARDTOMPI_H
10+
#define MLIR_CONVERSION_SHARDTOMPI_SHARDTOMPI_H
1111

1212
#include "mlir/Pass/Pass.h"
1313
#include "mlir/Support/LLVM.h"
1414

1515
namespace mlir {
1616
class Pass;
1717

18-
#define GEN_PASS_DECL_CONVERTMESHTOMPIPASS
18+
#define GEN_PASS_DECL_CONVERTSHARDTOMPIPASS
1919
#include "mlir/Conversion/Passes.h.inc"
2020

2121
} // namespace mlir
2222

23-
#endif // MLIR_CONVERSION_MESHTOMPI_MESHTOMPI_H
23+
#endif // MLIR_CONVERSION_SHARDTOMPI_SHARDTOMPI_H

mlir/include/mlir/Dialect/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ add_subdirectory(Linalg)
1919
add_subdirectory(LLVMIR)
2020
add_subdirectory(Math)
2121
add_subdirectory(MemRef)
22-
add_subdirectory(Mesh)
22+
add_subdirectory(Shard)
2323
add_subdirectory(MLProgram)
2424
add_subdirectory(MPI)
2525
add_subdirectory(NVGPU)

mlir/include/mlir/Dialect/Func/Extensions/MeshShardingExtensions.h renamed to mlir/include/mlir/Dialect/Func/Extensions/ShardingExtensions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- MeshShardingExtensions.h - -----------------------------------------===//
1+
//===- ShardingExtensions.h - -----------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
//===- MeshShardingInterfaceImpl.h ----------------------------------------===//
1+
//===- ShardingInterfaceImpl.h ----------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef MLIR_DIALECT_LINALG_MESHSHARDINGINTERFACEIMPL_H
10-
#define MLIR_DIALECT_LINALG_MESHSHARDINGINTERFACEIMPL_H
9+
#ifndef MLIR_DIALECT_LINALG_SHARDSHARDINGINTERFACEIMPL_H
10+
#define MLIR_DIALECT_LINALG_SHARDSHARDINGINTERFACEIMPL_H
1111

1212
namespace mlir {
1313
class DialectRegistry;
1414

1515
namespace linalg {
16-
void registerMeshShardingInterfaceExternalModels(DialectRegistry &registry);
16+
void registerShardingInterfaceExternalModels(DialectRegistry &registry);
1717
} // namespace linalg
1818
} // namespace mlir
1919

20-
#endif // MLIR_DIALECT_LINALG_MESHSHARDINGINTERFACEIMPL_H
20+
#endif // MLIR_DIALECT_LINALG_SHARDSHARDINGINTERFACEIMPL_H

mlir/include/mlir/Dialect/Mesh/IR/CMakeLists.txt

Lines changed: 0 additions & 25 deletions
This file was deleted.

mlir/include/mlir/Dialect/Mesh/Transforms/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)