Skip to content
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

refactor: cleanup KLR definitions #17

Merged
merged 1 commit into from
Jan 10, 2025
Merged

refactor: cleanup KLR definitions #17

merged 1 commit into from
Jan 10, 2025

Conversation

govereau
Copy link
Collaborator

@govereau govereau commented Jan 8, 2025

Remove some unnecessary parts of KLR, and reorganize the source files.

@govereau govereau self-assigned this Jan 8, 2025
@govereau govereau requested a review from jtristan as a code owner January 8, 2025 11:07
@govereau govereau requested a review from seanmcl January 8, 2025 11:08
NKL/KLR/Basic.lean Show resolved Hide resolved
NKL/KLR/Basic.lean Show resolved Hide resolved
NKL/KLR/Basic.lean Outdated Show resolved Hide resolved
NKL/KLR/Basic.lean Show resolved Hide resolved
NKL/KLR/Basic.lean Show resolved Hide resolved
NKL/KLR/Basic.lean Show resolved Hide resolved
NKL/KLR/Basic.lean Show resolved Hide resolved

inductive Stmt where
| pass
| expr (v : Expr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is expr a statement in a language without side effects?

Copy link
Collaborator Author

@govereau govereau Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good question. The (admittedly bad) answer is that I am not sure KLR is the final step. Maybe it isn't pure, but there is a transform we can do to make it pure. For example, we see stuff like:

# in nki.isa
 def builtin_custom_op(fn_name, file_name, ucode_version, isa_version, srcs, dsts, **kwargs):

If you call this function, it would look like:

def kernel(...):
  ...
  builtin_custom_op("name", "file", 1, 1, a, b)
  return b

Right, now the call to builtin_custom_op would be one of these expression statements. Not sure what to do here? I think we need to look one-by-one at the ISA operations.

Base automatically changed from pg-defaults to main January 10, 2025 17:13
Remove some unnecessary parts of KLR, and reorganize the source files.
NKL/KLR/Basic.lean Show resolved Hide resolved
NKL/KLR/Basic.lean Show resolved Hide resolved
NKL/KLR/Basic.lean Show resolved Hide resolved
NKL/KLR/Basic.lean Show resolved Hide resolved
NKL/KLR/Basic.lean Show resolved Hide resolved
@govereau govereau merged commit 847f159 into main Jan 10, 2025
1 check passed
@govereau govereau deleted the pg-klr branch January 10, 2025 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants