-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for linalg.conv1d
#4
base: main
Are you sure you want to change the base?
Conversation
) | ||
zigzag_description[ | ||
"equation" | ||
] = f"{output_access} = {input_i_access} * {input_w_access}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is black
formatting I'm afraid, but we might want to sync at some point.
@@ -133,8 +146,6 @@ def match_and_rewrite(self, generic_op: Generic, rewriter: PatternRewriter): | |||
# padding (use default of 0 padding for now) | |||
# affects last two indices of input I | |||
zigzag_description["padding"] = dict() | |||
zigzag_description["padding"][str(indexing_maps[0].results[0]).upper()] = (0, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jorendumoulin told me it's OK to elide this for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zigzag throws an error when I try to feed it the conv_1_d workload:
python xdsl_opt_main.py tests/conv_1d_generic.mlir -p linalg-to-stream && python run_zigzag.py
produces
Traceback (most recent call last):
File "/home/emily/linalg-to-stream/run_zigzag.py", line 14, in <module>
answers = zigzag.api.get_hardware_performance_zigzag(workload, accelerator, mapping, "latency", "outputs/my-output.json","outputs/list_of_cmes.pickle")
File "/home/emily/linalg-to-stream/.env/lib/python3.10/site-packages/zigzag/api.py", line 78, in get_hardware_performance_zigzag
answers = mainstage.run()
File "/home/emily/linalg-to-stream/.env/lib/python3.10/site-packages/zigzag/classes/stages/Stage.py", line 49, in run
for cme, extra_info in self.list_of_callables[0](
File "/home/emily/linalg-to-stream/.env/lib/python3.10/site-packages/zigzag/classes/stages/MainInputParserStages.py", line 55, in run
workload = parse_workload_from_path_or_from_module(self.workload, self.mapping)
File "/home/emily/linalg-to-stream/.env/lib/python3.10/site-packages/zigzag/classes/stages/MainInputParserStages.py", line 41, in parse_workload_from_path_or_from_module
workload = DNNWorkload(workload_copy, mapping)
File "/home/emily/linalg-to-stream/.env/lib/python3.10/site-packages/zigzag/classes/workload/dnn_workload.py", line 32, in __init__
layer_node = LayerNode(layer_id, layer)
File "/home/emily/linalg-to-stream/.env/lib/python3.10/site-packages/zigzag/classes/workload/layer_node.py", line 118, in __init__
pr_loop, pr_loop_list, pr_scaling_factors = self.build_pr_funcs()
File "/home/emily/linalg-to-stream/.env/lib/python3.10/site-packages/zigzag/classes/workload/layer_node.py", line 158, in build_pr_funcs
pr_loop, pr_loop_list, pr_scaling_factors = self.extract_pr_loop_info(
File "/home/emily/linalg-to-stream/.env/lib/python3.10/site-packages/zigzag/classes/workload/layer_node.py", line 301, in extract_pr_loop_info
len(scaling_factors) == 2
AssertionError: Please remove any constants in the equation relation iJ=d0+d1.
Not sure if the error means the workload is incorrect, or if the calling of the zigzag api is incorrect. I will keep investigating this, but until it's clear why run_zigzag is failing, I don't think we should merge this PR.
OK, this happened before I had Things to try:
|
Update: I can reproduce the assertion |
It turns out that parsing the workload description is quite finicky since ZigZag cannot parse dimensions workload = {
0: {
"operator_type": "default",
"equation": "O[x] += I[im] * W[y]",
"dimension_relations": ["im=x+y"],
"loop_dim_size": {"X": 16, "Y": 3},
"operand_precision": {"O": 32, "O_final": 32, "W": 32, "I": 32},
"operand_source": {"W": [], "I": []},
"constant_operands": ["I", "W"],
"padding": {},
}
} and I got an Can you please confirm with above worload file that the output makes some sense (my understanding is embryonic on that front ATM). If so, I'll amend the PR to avoid using |
Hoping to update this today :) |
Hello Chris,
to
Let me know if these changes are too tedious, in which case you are welcome to offload them to me :) |
@EmilySillars thanks for all this. A question regarding 3.: what does "fully work" mean and how was this identified? |
"fully work" means the output from zigzag produces both a valid temporal and spatial mapping.
To me this workload looks correct because there is a memory level (l1, rf_32b_O) assigned to each operand, and the loop dimensions in the temporal mapping multiplied together are equal to the original loop dimensions from the workload. For example, the workload input says "loop_dim_size": {"X": 16, "Y": 3}, and looking at zigzag's temporal loop output, 2 * 2 *2 *2 = 16, and 3 = 3. |
This PR:
linalg.conv1d