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

Pr/microbench dispatch #24

Open
wants to merge 10 commits into
base: pr/constants
Choose a base branch
from
Open

Conversation

zdevito
Copy link
Owner

@zdevito zdevito commented Apr 4, 2018

No description provided.

`Const` allows you to mark certain python attributes of a modules constant,
enabling script methods to use them in way that are otherwise not allowed.

* This includes using python constants like `use_bias` in if statements.

* Add support for unrolledFor to torch.jit.Const
Rather than check raw lists contain modules that are registered,
just make the module list itself a submodule like nn.Module
Like `__slots__` the `__constants__` property changes the set/getattr
behavior for the keys listed so they behave as constants.

This makes it clear that constant-ness is a property of the module
and not the value.
zdevito pushed a commit that referenced this pull request Sep 11, 2018
…orms we care about. (pytorch#11394)

Summary:
While the use of memcpy as part of the byte swapping sequence looks funky, all major
compilers recognize and optimize this pattern reliably, resulting in essentially
optimal code generation.

For example, decodeUInt32LE goes from this on iOS arm64:
>         ldrb    w8, [x0, #3]
>         ldrb    w9, [x0, #2]
>         bfi     w8, w9, #8, #8
>         ldrb    w9, [x0, #1]
>         bfi     w8, w9, #16, #8
>         ldrb            w9, [x0]
>         bfi     w8, w9, #24, #8
>         mov      x0, x8
>         ret

To this:
>         ldr             w8, [x0]
>         rev     w0, w8
>         ret
Pull Request resolved: pytorch#11394

Reviewed By: SsnL

Differential Revision: D9728659

Pulled By: resistor

fbshipit-source-id: 9afbd4adfad1d1fb7b01f1179e6707ee21fa726f
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.

1 participant