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] Atomic demotion for bit struct stores #2174

Merged
merged 2 commits into from
Jan 25, 2021

Conversation

xumingkuan
Copy link
Contributor

Related issue = #1905

Test case(0.75s -> 0.42s)

import taichi as ti

ti.init(arch=ti.cpu, kernel_profiler=True, print_ir=True, quant_opt_atomic_demotion=True)

quant = True

n = 1024 * 1024 * 256

if quant:
    ci16 = ti.quant.int(16, True)

    x = ti.field(dtype=ci16)
    y = ti.field(dtype=ci16)

    ti.root.dense(ti.i, n).bit_struct(num_bits=32).place(x, y)
else:
    x = ti.field(dtype=ti.i16)
    y = ti.field(dtype=ti.i16)

    ti.root.dense(ti.i, n).place(x, y)


@ti.kernel
def foo():
    for i in range(n):
        x[i] = 1


for i in range(10):
    foo()

ti.kernel_profiler_print()

[Click here for the format server]


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.

@yuanming-hu yuanming-hu merged commit 3da03f5 into taichi-dev:master Jan 25, 2021
@k-ye k-ye mentioned this pull request Feb 4, 2021
@xumingkuan xumingkuan deleted the bit-atomic branch March 13, 2021 12:16
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