Skip to content

Commit 8e74bd2

Browse files
Groverkssclaude
andcommitted
[Codegen] Add iree_map dialect with PackMapAttr
Introduces the `iree_map` dialect and `PackMapAttr`, a layout map defined by a (Shape, Stride) pair of hierarchical IntTuples. Provides layout algebra operations (compose, complement, logicalDivide, logicalProduct, filter, rightInverse, etc.) for use in vector distribution passes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 04784a9 commit 8e74bd2

21 files changed

Lines changed: 2426 additions & 0 deletions
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright 2026 The IREE Authors
2+
#
3+
# Licensed under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
7+
package(
8+
default_visibility = ["//visibility:public"],
9+
features = ["layering_check"],
10+
licenses = ["notice"], # Apache 2.0
11+
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
################################################################################
2+
# Autogenerated by build_tools/bazel_to_cmake/bazel_to_cmake.py from #
3+
# compiler/src/iree/compiler/Codegen/Dialect/Map/BUILD.bazel #
4+
# #
5+
# Use iree_cmake_extra_content from iree/build_defs.oss.bzl to add arbitrary #
6+
# CMake-only content. #
7+
# #
8+
# To disable autogeneration for this file entirely, delete this header. #
9+
################################################################################
10+
11+
iree_add_all_subdirs()
12+
13+
### BAZEL_TO_CMAKE_PRESERVES_ALL_CONTENT_BELOW_THIS_LINE ###
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Copyright 2026 The IREE Authors
2+
#
3+
# Licensed under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
7+
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library", "iree_gentbl_cc_library", "iree_td_library")
8+
load("//build_tools/bazel:enforce_glob.bzl", "enforce_glob")
9+
10+
package(
11+
default_visibility = ["//visibility:public"],
12+
features = ["layering_check"],
13+
licenses = ["notice"], # Apache 2.0
14+
)
15+
16+
exports_files([
17+
"IREEMapAttrs.td",
18+
"IREEMapBase.td",
19+
])
20+
21+
iree_td_library(
22+
name = "td_files",
23+
srcs = enforce_glob(
24+
# keep sorted
25+
[
26+
"IREEMapAttrs.td",
27+
"IREEMapBase.td",
28+
],
29+
include = ["*.td"],
30+
),
31+
deps = [
32+
"@llvm-project//mlir:OpBaseTdFiles",
33+
],
34+
)
35+
36+
iree_compiler_cc_library(
37+
name = "IREEMapDialect",
38+
srcs = [
39+
"IREEMapAttrs.cpp",
40+
"IREEMapDialect.cpp",
41+
"IntTuple.cpp",
42+
],
43+
hdrs = [
44+
"IREEMapAttrs.h",
45+
"IREEMapDialect.h",
46+
"IntTuple.h",
47+
],
48+
textual_hdrs = [
49+
"IREEMapAttrs.cpp.inc",
50+
"IREEMapAttrs.h.inc",
51+
"IREEMapDialect.cpp.inc",
52+
"IREEMapDialect.h.inc",
53+
],
54+
deps = [
55+
":IREEMapAttrsGen",
56+
":IREEMapDialectGen",
57+
"@llvm-project//llvm:Support",
58+
"@llvm-project//mlir:IR",
59+
"@llvm-project//mlir:Support",
60+
],
61+
)
62+
63+
iree_gentbl_cc_library(
64+
name = "IREEMapDialectGen",
65+
tbl_outs = [
66+
(
67+
["--gen-dialect-decls"],
68+
"IREEMapDialect.h.inc",
69+
),
70+
(
71+
["--gen-dialect-defs"],
72+
"IREEMapDialect.cpp.inc",
73+
),
74+
],
75+
tblgen = "@llvm-project//mlir:mlir-tblgen",
76+
td_file = "IREEMapBase.td",
77+
deps = [":td_files"],
78+
)
79+
80+
iree_gentbl_cc_library(
81+
name = "IREEMapAttrsGen",
82+
tbl_outs = [
83+
(
84+
["--gen-attrdef-decls"],
85+
"IREEMapAttrs.h.inc",
86+
),
87+
(
88+
["--gen-attrdef-defs"],
89+
"IREEMapAttrs.cpp.inc",
90+
),
91+
],
92+
tblgen = "@llvm-project//mlir:mlir-tblgen",
93+
td_file = "IREEMapAttrs.td",
94+
deps = [":td_files"],
95+
)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
################################################################################
2+
# Autogenerated by build_tools/bazel_to_cmake/bazel_to_cmake.py from #
3+
# compiler/src/iree/compiler/Codegen/Dialect/Map/IR/BUILD.bazel #
4+
# #
5+
# Use iree_cmake_extra_content from iree/build_defs.oss.bzl to add arbitrary #
6+
# CMake-only content. #
7+
# #
8+
# To disable autogeneration for this file entirely, delete this header. #
9+
################################################################################
10+
11+
iree_add_all_subdirs()
12+
13+
iree_cc_library(
14+
NAME
15+
IREEMapDialect
16+
HDRS
17+
"IREEMapAttrs.h"
18+
"IREEMapDialect.h"
19+
"IntTuple.h"
20+
TEXTUAL_HDRS
21+
"IREEMapAttrs.cpp.inc"
22+
"IREEMapAttrs.h.inc"
23+
"IREEMapDialect.cpp.inc"
24+
"IREEMapDialect.h.inc"
25+
SRCS
26+
"IREEMapAttrs.cpp"
27+
"IREEMapDialect.cpp"
28+
"IntTuple.cpp"
29+
DEPS
30+
::IREEMapAttrsGen
31+
::IREEMapDialectGen
32+
LLVMSupport
33+
MLIRIR
34+
MLIRSupport
35+
PUBLIC
36+
)
37+
38+
iree_tablegen_library(
39+
NAME
40+
IREEMapDialectGen
41+
TD_FILE
42+
"IREEMapBase.td"
43+
OUTS
44+
--gen-dialect-decls IREEMapDialect.h.inc
45+
--gen-dialect-defs IREEMapDialect.cpp.inc
46+
)
47+
48+
iree_tablegen_library(
49+
NAME
50+
IREEMapAttrsGen
51+
TD_FILE
52+
"IREEMapAttrs.td"
53+
OUTS
54+
--gen-attrdef-decls IREEMapAttrs.h.inc
55+
--gen-attrdef-defs IREEMapAttrs.cpp.inc
56+
)
57+
58+
### BAZEL_TO_CMAKE_PRESERVES_ALL_CONTENT_BELOW_THIS_LINE ###

0 commit comments

Comments
 (0)