Csl wrapper
csl_wrapper
¶
i16 = builtin.IntegerType(16)
module-attribute
¶
CSL_WRAPPER = Dialect('csl_wrapper', [ImportOp, ModuleOp, YieldOp], [ParamAttribute])
module-attribute
¶
ParamAttribute
dataclass
¶
Bases: ParametrizedAttribute
Represents a module parameter that needs to have a type, and may have a value.
Source code in xdsl/dialects/csl_wrapper.py
name = 'csl_wrapper.param'
class-attribute
instance-attribute
¶
key: StringAttr
instance-attribute
¶
value: IntegerAttr[IntegerType] | NoneAttr
instance-attribute
¶
type: IntegerType
instance-attribute
¶
print_parameters(printer: Printer) -> None
¶
Source code in xdsl/dialects/csl_wrapper.py
parse_parameters(parser: AttrParser) -> Sequence[Attribute]
classmethod
¶
Source code in xdsl/dialects/csl_wrapper.py
ImportOp
¶
Bases: IRDLOperation
Lightweight wrapper around csl.import_module that allows specifying field names directly
and removes the need for handling structs or setting up struct operands.
Where existing structs need to be used in the import, they can be passed with an empty field name. This will concatenate them all together.
Named fields and empty fields can be used in the same import
Source code in xdsl/dialects/csl_wrapper.py
name = 'csl_wrapper.import'
class-attribute
instance-attribute
¶
ops = var_operand_def()
class-attribute
instance-attribute
¶
module = prop_def(StringAttr)
class-attribute
instance-attribute
¶
fields = prop_def(ArrayAttr[StringAttr])
class-attribute
instance-attribute
¶
result = result_def(csl.ImportedModuleType)
class-attribute
instance-attribute
¶
__init__(module: str, field_name_mapping: dict[str, Operation | SSAValue])
¶
Source code in xdsl/dialects/csl_wrapper.py
ModuleOp
¶
Bases: IRDLOperation
Wrapper class that manages initialisation of layout and program module.
Specified properties will be lowered to module params (csl.param). As such, all properties
are passed as BlockArgs to the layout_module and program_module region. The order in which
properties are specified is important and must match the order of the block args.
Additionally, any value yielded by the layout_module is passed as a block arg (lowered to csl.param)
to the program module. Order is important here as well. The layout module's yield op should be lowered to
@set_tile_code, while the program module's yield op should be discarded.
The layout module has two additional block args x and y as part of the @set_tile_code loop nest.
Operations using these args need to be lowered to the correct place in the loop nest.
The layout module has the following args (in order):
* set_tile_code params: x and y
* general params: width and height followed by everything specified in params
The program module has the following args (in order):
* general params: width and height followed by everything specified in params
* params from layout: everything defined by layout_yield_op.fields
Source code in xdsl/dialects/csl_wrapper.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
name = 'csl_wrapper.module'
class-attribute
instance-attribute
¶
width = prop_def(IntegerAttr[IntegerType])
class-attribute
instance-attribute
¶
height = prop_def(IntegerAttr[IntegerType])
class-attribute
instance-attribute
¶
program_name = opt_prop_def(StringAttr)
class-attribute
instance-attribute
¶
target = prop_def(StringAttr)
class-attribute
instance-attribute
¶
params = prop_def(ArrayAttr[ParamAttribute])
class-attribute
instance-attribute
¶
layout_module = region_def('single_block')
class-attribute
instance-attribute
¶
program_module = region_def('single_block')
class-attribute
instance-attribute
¶
layout_yield_op: YieldOp
property
¶
Get the yield op from the layout module. Used in various places.
exported_symbols: Sequence[BlockArgument]
property
¶
Get the exported symbols.
__init__(width: int | IntegerAttr[IntegerType], height: int | IntegerAttr[IntegerType], target: csl.Target | StringAttr, params: dict[str, IntegerAttr[IntegerType]] | Sequence[ParamAttribute] | None = None)
¶
Source code in xdsl/dialects/csl_wrapper.py
update_program_block_args(yield_args: Iterable[tuple[str, SSAValue]] | None = None)
¶
Update program_module BlockArguments by adding
1. yield op fields (pass None to enable automated retrieval, pass empty list to add no yield op fields)
2. additional exported symbols
Source code in xdsl/dialects/csl_wrapper.py
verify_()
¶
Source code in xdsl/dialects/csl_wrapper.py
get_layout_param(name: str) -> BlockArgument
¶
Retrieve layout block arg for name that is x, y, or one of the properties
Source code in xdsl/dialects/csl_wrapper.py
get_program_param(name: str) -> BlockArgument
¶
Retrieve program block arg for name that is one of the properties or a param set up by layout yield
Source code in xdsl/dialects/csl_wrapper.py
get_param_value(name: str) -> IntegerAttr[IntegerType]
¶
Retrieve the value of a named op param.
Source code in xdsl/dialects/csl_wrapper.py
get_program_import(name: str) -> ImportOp
¶
Get top-level import op in the program_module
Source code in xdsl/dialects/csl_wrapper.py
YieldOp
¶
Bases: IRDLOperation
Layout module yield ops should be lowered to @set_tile_code and must specify fields.
Program module yield ops have no particular meaning and specify fields here is permitted but undefined.