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/csl_wrapper.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
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/csl_wrapper.py
58 59 60 61 62 63 64 65 66 | |
parse_parameters(parser: AttrParser) -> Sequence[Attribute]
classmethod
Source code in xdsl/dialects/csl/csl_wrapper.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
verify() -> None
Source code in xdsl/dialects/csl/csl_wrapper.py
84 85 86 87 88 89 90 | |
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/csl_wrapper.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
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/csl_wrapper.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
verify_() -> None
Source code in xdsl/dialects/csl/csl_wrapper.py
130 131 132 | |
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/csl_wrapper.py
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 366 | |
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/csl_wrapper.py
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 | |
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/csl_wrapper.py
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 | |
verify_()
Source code in xdsl/dialects/csl/csl_wrapper.py
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 | |
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/csl_wrapper.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
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/csl_wrapper.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
get_param_value(name: str) -> IntegerAttr[IntegerType]
Retrieve the value of a named op param.
Source code in xdsl/dialects/csl/csl_wrapper.py
331 332 333 334 335 336 337 338 339 340 341 342 343 | |
get_program_import(name: str) -> ImportOp
Get top-level import op in the program_module
Source code in xdsl/dialects/csl/csl_wrapper.py
361 362 363 364 365 366 | |
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.
Source code in xdsl/dialects/csl/csl_wrapper.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | |
name = 'csl_wrapper.yield'
class-attribute
instance-attribute
values = var_operand_def(Attribute)
class-attribute
instance-attribute
fields = prop_def(ArrayAttr[StringAttr])
class-attribute
instance-attribute
traits = lazy_traits_def(lambda: (IsTerminator(), HasParent(ModuleOp), Pure()))
class-attribute
instance-attribute
__init__(operands: Sequence[SSAValue | Operation], args: Sequence[str] | ArrayAttr[StringAttr])
Source code in xdsl/dialects/csl/csl_wrapper.py
389 390 391 392 393 394 395 396 397 398 399 400 401 | |
from_field_name_mapping(field_name_mapping: dict[str, Operation | SSAValue])
staticmethod
Source code in xdsl/dialects/csl/csl_wrapper.py
403 404 405 406 407 408 409 410 | |
verify_() -> None
Source code in xdsl/dialects/csl/csl_wrapper.py
412 413 414 | |
items() -> Iterable[tuple[str, SSAValue]]
Source code in xdsl/dialects/csl/csl_wrapper.py
416 417 418 | |