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] [refactor] Decouple quant from SNode 3/n: Extend bit pointers #5232

Merged
merged 2 commits into from
Jun 23, 2022

Conversation

strongoier
Copy link
Contributor

@strongoier strongoier commented Jun 22, 2022

Related issue = #4857

The original bit pointer is like:

struct bit_pointer {
    i8 *byte_ptr;
    i32 bit_offset;
};

When creating a new bit pointer, the byte_ptr is always cast into i8 * first. Then a physical type needs to get passed alongside to allow access of its pointee.

As you may have noticed, the byte_ptr is not a pointer to a byte, but simply a byte-level pointer, which can point to any primitive type. Therefore, there is actually no need to force byte_ptr as i8 *. Then info of its physical type can be easily preserved by extending the definition of bit pointers:

// X=8/16/32/64
struct bit_pointer_X {
    iX *byte_ptr;
    i32 bit_offset;
}

After this change, logic around bit pointers can get simplified a lot.

@netlify
Copy link

netlify bot commented Jun 22, 2022

Deploy Preview for docsite-preview canceled.

Name Link
🔨 Latest commit def861f
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/62b2e80cfc6bce0008092fc5

@strongoier strongoier marked this pull request as ready for review June 22, 2022 12:09
@strongoier strongoier requested review from k-ye and ailzhang June 22, 2022 12:09
Copy link
Member

@k-ye k-ye left a comment

Choose a reason for hiding this comment

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

LGTM!

taichi/codegen/codegen_llvm.cpp Show resolved Hide resolved
@strongoier strongoier merged commit 6357cf0 into taichi-dev:master Jun 23, 2022
@strongoier strongoier deleted the extend-bit-ptrs branch June 23, 2022 05:12
This pull request was closed.
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