-
Notifications
You must be signed in to change notification settings - Fork 1
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
[WIP] subprocess version of python/lean communication #25
Conversation
Had to comment out the `assert` statements which aren't supported yet, but this makes the getting-started example go through $ interop/test.sh json file: /var/folders/hz/hgkdl8pj5fg_zlm2qh8x8fy40000gr/T/tmp6iaqtmi8.json 4 = nki.language.load(%a_input<float64:128,512>) 5 = nki.language.load(%b_input<float64:128,512>) 6 = nki.language.add(4,5) 7 = nki.language.store(%c_output<float64:128,512>,value=6) Just an idea.
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.
In general, I think this approach better, it is easier to maintain. I am not entirely convinced that we won't need to integrate more closely with python in the future, but we can cross that bridge if we come to it.
1. Python parser parses kernel.py to JSON (using reflection) | ||
2. Python writes kernel.json | ||
3. KLR reads kernel.json | ||
4. KLR writes klr.json |
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.
So, technically you are not writing KLR.json, right?
Do you just need to derive Lean.ToJson
on the KLR types and call toJson
?
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.
Yeah, I just copied the text format back to Python for the poc. I'll call toJson
.
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.
Now the example test writes
$ python3 test/test_examples.py
[{"assign":
{"x": "4",
"e":
{"call":
{"kwargs": [],
"f": {"var": {"x": "nki.language.load"}},
"args":
[{"tensor":
{"t":
{"shape": [128, 512], "name": "a_input", "dtype": "float64"}}}]}}}},
{"assign":
{"x": "5",
"e":
{"call":
{"kwargs": [],
"f": {"var": {"x": "nki.language.load"}},
"args":
[{"tensor":
{"t":
{"shape": [128, 512], "name": "b_input", "dtype": "float64"}}}]}}}},
{"assign":
{"x": "6",
"e":
{"call":
{"kwargs": [],
"f": {"var": {"x": "nki.language.add"}},
"args": [{"var": {"x": "4"}}, {"var": {"x": "5"}}]}}}},
{"assign":
{"x": "7",
"e":
{"call":
{"kwargs": [["value", {"var": {"x": "6"}}]],
"f": {"var": {"x": "nki.language.store"}},
"args":
[{"tensor":
{"t":
{"shape": [128, 512], "name": "c_output", "dtype": "float64"}}}]}}}}]
Good enough 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.
Seems ok. I am working out the BIR output now, it will be similar.
Had to comment out the
assert
statements which aren't supported yet, but this makes the getting-started example go throughJust an idea.