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

[type] [opt] Use BitStructStoreStmt for CustomFloatType with non-shared exponents #2259

Merged
merged 6 commits into from
Apr 13, 2021

Conversation

xumingkuan
Copy link
Contributor

@xumingkuan xumingkuan commented Apr 12, 2021

Related issue = #1905 #2128

This PR adds support of CustomFloatType with non-shared exponents in BitStructStoreStmt.

Now the codegen workflow of BitStructStoreStmt looks like the follows:

  1. Generate the code for all shared-exponent floating type stores (do not generate the code for non-shared exponent floating type stores here).
  2. For each other store, generate the code, and bit_or it to bit_struct_val. For CustomFloatType with non-shared exponents, we need to generate the code of storing both the exponent and the fraction (code mainly copied from visit(GlobalStoreStmt *)).
  3. Generate the mask of the bits stored in step 2.
  4. If the mask is full, or if the BitStructStoreStmt itself is not atomic (probably because it's the only access to a loop index), generate a masked store; otherwise, generate an __atomic_compare_exchange.

We can remove the support of custom float type in GlobalStoreStmt to make the codebase cleaner in the future in this PR.

[Click here for the format server]


@xumingkuan xumingkuan marked this pull request as draft April 12, 2021 12:34
@xumingkuan xumingkuan marked this pull request as ready for review April 12, 2021 13:09
@xumingkuan xumingkuan requested a review from yuanming-hu April 13, 2021 06:00
Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

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

Awesome! LGTM. Thank you very much :-)

@yuanming-hu yuanming-hu merged commit 0500e13 into taichi-dev:master Apr 13, 2021
@xumingkuan xumingkuan deleted the atomic-cft branch April 20, 2021 05:10
@k-ye k-ye mentioned this pull request Apr 25, 2021
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