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

ASR 64-bit lane not available in sse instruction #3413

Merged
merged 1 commit into from
Dec 31, 2024

Conversation

gretay-js
Copy link
Contributor

Packed shift right arithmetic instruction PSRA is only available for 32 and 16 bit elements. Handling 64-bit elements requires AVX512, which is not currently supported in flambda-backend. The vectorizer is able to identify 64x2 group correctly for Iasr instruction, but Simd_selection.vectorize_operation fails with an asssert. This PR fixes it to return None for this case that is not yet vectorizable.

There are many other cases with assert false that should be either None or Misc.fatal_error, but I'll leave them for a separate PR, as part of the planned refactoring of vectorize_operation. For now, this PR just fixes a common case (due to untagging), so we can continue testing the vectorizer.

- return None instead of assert
- TODO: check all other cases!
@gretay-js gretay-js added bug Something isn't working vectorizer labels Dec 30, 2024
@gretay-js gretay-js requested a review from xclerc December 30, 2024 16:46
@gretay-js gretay-js merged commit ab229fc into ocaml-flambda:main Dec 31, 2024
22 checks passed
jvanburen added a commit that referenced this pull request Jan 2, 2025
commit d1acc48
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Thu Jan 2 14:53:51 2025 -0500

    Squashed commit of the following:

    commit c9d7aa6
    Author: Jacob Van Buren <jvanburen@janestreet.com>
    Date:   Thu Jan 2 14:49:45 2025 -0500

        cleaned up div/mod

    commit 4d9f427
    Author: Jacob Van Buren <jvanburen@janestreet.com>
    Date:   Thu Jan 2 14:45:42 2025 -0500

        address feedback and simplify division interface

commit 625a416
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Tue Dec 31 11:00:07 2024 -0500

    unified unboxed field getters/setters. This will be useful once we have unboxed integers of different sizes

commit 37b4e82
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Tue Dec 31 09:40:53 2024 -0500

    formatted

commit 1746aa8
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Mon Dec 30 11:37:33 2024 -0500

    updated cmm_helpers interface to be more amenable to adding other integer sizes

commit 9e7c322
Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com>
Date:   Tue Dec 31 12:01:21 2024 +0000

    Separate test for vectorizer in the CI (#3414)

    * Separate test for vectorizer in the CI

    * Remove vectorizer from "gi" CI job

commit e1a5fe4
Author: Xavier Clerc <xclerc@users.noreply.github.com>
Date:   Tue Dec 31 10:54:43 2024 +0000

    CI: simplify the regalloc jobs (#3389)

commit ab229fc
Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com>
Date:   Tue Dec 31 10:42:37 2024 +0000

    ASR 64-bit lane not available in sse instruction (#3413)

commit 8b99545
Author: Thomas Del Vecchio <127883551+tdelvecchio-jsc@users.noreply.github.com>
Date:   Mon Dec 30 14:26:48 2024 -0500

    Fix case where parser drops attributes in packed module types. (#3262)

    * Demonstrate dropped attributes in test.

    Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com>

    * Syntax error on misplaced attribute in packed module types.

    Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com>

    ---------

    Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com>

commit fe97beb
Author: Aspen Smith <aspsmith@janestreet.com>
Date:   Sat Dec 28 11:47:55 2024 -0500

    Add attributes to (unsafely) skip jkind check  (#3385)

    * Add attributes to (unsafely) skip jkind check

    Add a pair of attributes, [@@unsafe_allow_any_kind_in_intf] and
    [@@unsafe_allow_any_kind_in_impl], which if set on both the impl and the intf
    respectively, skip checking the jkind of the type in a signature against the
    jkind of the type in a struct entirely. This is a more-selective version of the
    `--allow-illegal-crossing` flag, and likely eventually subsumes it.

    Signed-off-by: Aspen Smith <aspsmith@janestreet.com>

    * Emit a warning when unsafe_allow_any_kind is added unnecessarily

    Note that this is /only/ done if the attribute is set in both signatures but not
    used - also this is a little over-sensitive (sadly) since this is done during
    sigature inclusion too. A new test covers the over-sensitivity.

    Signed-off-by: Aspen Smith <aspsmith@janestreet.com>

    ---------

    Signed-off-by: Aspen Smith <aspsmith@janestreet.com>

commit 862ced2
Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com>
Date:   Thu Dec 26 15:20:06 2024 -0500

    Add `Variant_with_null` and `Null` variant constructors (#2870)

    * `Variant_with_null`

    * `Null` tagged constructors

    * precise value kind

    * No private re-export

    ---------

    Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com>

commit 1eeed87
Author: Mark Shinwell <mshinwell@pm.me>
Date:   Thu Dec 26 15:00:49 2024 +0000

    Revert "Implement %makearray_dynamic{,_uninit}" (#3408)

    Revert "Implement %makearray_dynamic{,_uninit} (#3317)"

    This reverts commit 6da1dde.

commit 2358e09
Author: Mark Shinwell <mshinwell@pm.me>
Date:   Tue Dec 24 15:54:06 2024 +0000

    Upload core files etc upon CI failure (#3405)

commit dc6e300
Author: Xavier Clerc <xclerc@users.noreply.github.com>
Date:   Tue Dec 24 10:06:20 2024 +0100

    Fix IRC and Greedy allocators (arm64) (#3388)

commit 65c0596
Author: Max Slater <max@thenumb.at>
Date:   Mon Dec 23 16:49:37 2024 -0500

    Convert float32 constants to int32 in first stage compiler (#3371)

    * convert float32 constants in bytecode output

    * edit

    * edit

    * blocks + test

    * compare against float64 constants

    * tests check proper custom ops

    ---------

    Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com>
gretay-js added a commit to gretay-js/flambda-backend that referenced this pull request Jan 10, 2025
jvanburen added a commit that referenced this pull request Jan 22, 2025
commit 1b4978a
Merge: 80b7111 c7361a4
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Wed Jan 22 14:51:42 2025 -0500

    Merge branch 'refactor-cmm-for-more-integer-widths' into cmm-scalar-type

commit c7361a4
Merge: 0052ebb d0e8914
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Wed Jan 22 14:45:04 2025 -0500

    Merge branch 'cmm-refactor-unboxed-fields' into refactor-cmm-for-more-integer-widths

commit d0e8914
Merge: abcd725 dd1d945
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Wed Jan 22 14:22:34 2025 -0500

    Merge branch 'generalize-cmm-helpers-interface' into cmm-refactor-unboxed-fields

commit dd1d945
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Tue Jan 21 13:10:36 2025 -0500

    sped up division tests

commit 958b4d3
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Tue Jan 21 12:36:32 2025 -0500

    no specialize

commit 7033cfd
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Tue Jan 21 11:40:59 2025 -0500

    updated division tests

commit c5ab6a2
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Tue Jan 21 10:59:37 2025 -0500

    moved comment

commit f1a071b
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Tue Jan 21 10:58:42 2025 -0500

    re-added comment with disclaimer for d>1

commit 1a44076
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Fri Jan 17 15:44:03 2025 -0500

    testing division by constant optimzation

commit d54b895
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Fri Jan 17 15:40:56 2025 -0500

    responded to feedback

commit afe40f1
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Thu Jan 16 15:06:12 2025 -0500

    updated signed division by a negative constant to use the algorithm suggested in the referenced book

commit eff8c7e
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Thu Jan 16 13:01:05 2025 -0500

    responded to feedback

commit 80b7111
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Fri Jan 3 11:03:21 2025 -0500

    Added `Cmm_helpers.Scalar_type`. This provides utilities for converting between integers types of different widths and signedness. This is in preparation for adding unboxed small integer types.

commit abcd725
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Tue Dec 31 11:00:07 2024 -0500

    unified unboxed field getters/setters. This will be useful once we have unboxed integers of different sizes

commit 0052ebb
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Thu Jan 2 15:40:34 2025 -0500

    Squashed commit of the following:

    commit d1acc48
    Author: Jacob Van Buren <jvanburen@janestreet.com>
    Date:   Thu Jan 2 14:53:51 2025 -0500

        Squashed commit of the following:

        commit c9d7aa6
        Author: Jacob Van Buren <jvanburen@janestreet.com>
        Date:   Thu Jan 2 14:49:45 2025 -0500

            cleaned up div/mod

        commit 4d9f427
        Author: Jacob Van Buren <jvanburen@janestreet.com>
        Date:   Thu Jan 2 14:45:42 2025 -0500

            address feedback and simplify division interface

    commit 625a416
    Author: Jacob Van Buren <jvanburen@janestreet.com>
    Date:   Tue Dec 31 11:00:07 2024 -0500

        unified unboxed field getters/setters. This will be useful once we have unboxed integers of different sizes

    commit 37b4e82
    Author: Jacob Van Buren <jvanburen@janestreet.com>
    Date:   Tue Dec 31 09:40:53 2024 -0500

        formatted

    commit 1746aa8
    Author: Jacob Van Buren <jvanburen@janestreet.com>
    Date:   Mon Dec 30 11:37:33 2024 -0500

        updated cmm_helpers interface to be more amenable to adding other integer sizes

    commit 9e7c322
    Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com>
    Date:   Tue Dec 31 12:01:21 2024 +0000

        Separate test for vectorizer in the CI (#3414)

        * Separate test for vectorizer in the CI

        * Remove vectorizer from "gi" CI job

    commit e1a5fe4
    Author: Xavier Clerc <xclerc@users.noreply.github.com>
    Date:   Tue Dec 31 10:54:43 2024 +0000

        CI: simplify the regalloc jobs (#3389)

    commit ab229fc
    Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com>
    Date:   Tue Dec 31 10:42:37 2024 +0000

        ASR 64-bit lane not available in sse instruction (#3413)

    commit 8b99545
    Author: Thomas Del Vecchio <127883551+tdelvecchio-jsc@users.noreply.github.com>
    Date:   Mon Dec 30 14:26:48 2024 -0500

        Fix case where parser drops attributes in packed module types. (#3262)

        * Demonstrate dropped attributes in test.

        Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com>

        * Syntax error on misplaced attribute in packed module types.

        Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com>

        ---------

        Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com>

    commit fe97beb
    Author: Aspen Smith <aspsmith@janestreet.com>
    Date:   Sat Dec 28 11:47:55 2024 -0500

        Add attributes to (unsafely) skip jkind check  (#3385)

        * Add attributes to (unsafely) skip jkind check

        Add a pair of attributes, [@@unsafe_allow_any_kind_in_intf] and
        [@@unsafe_allow_any_kind_in_impl], which if set on both the impl and the intf
        respectively, skip checking the jkind of the type in a signature against the
        jkind of the type in a struct entirely. This is a more-selective version of the
        `--allow-illegal-crossing` flag, and likely eventually subsumes it.

        Signed-off-by: Aspen Smith <aspsmith@janestreet.com>

        * Emit a warning when unsafe_allow_any_kind is added unnecessarily

        Note that this is /only/ done if the attribute is set in both signatures but not
        used - also this is a little over-sensitive (sadly) since this is done during
        sigature inclusion too. A new test covers the over-sensitivity.

        Signed-off-by: Aspen Smith <aspsmith@janestreet.com>

        ---------

        Signed-off-by: Aspen Smith <aspsmith@janestreet.com>

    commit 862ced2
    Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com>
    Date:   Thu Dec 26 15:20:06 2024 -0500

        Add `Variant_with_null` and `Null` variant constructors (#2870)

        * `Variant_with_null`

        * `Null` tagged constructors

        * precise value kind

        * No private re-export

        ---------

        Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com>

    commit 1eeed87
    Author: Mark Shinwell <mshinwell@pm.me>
    Date:   Thu Dec 26 15:00:49 2024 +0000

        Revert "Implement %makearray_dynamic{,_uninit}" (#3408)

        Revert "Implement %makearray_dynamic{,_uninit} (#3317)"

        This reverts commit 6da1dde.

    commit 2358e09
    Author: Mark Shinwell <mshinwell@pm.me>
    Date:   Tue Dec 24 15:54:06 2024 +0000

        Upload core files etc upon CI failure (#3405)

    commit dc6e300
    Author: Xavier Clerc <xclerc@users.noreply.github.com>
    Date:   Tue Dec 24 10:06:20 2024 +0100

        Fix IRC and Greedy allocators (arm64) (#3388)

    commit 65c0596
    Author: Max Slater <max@thenumb.at>
    Date:   Mon Dec 23 16:49:37 2024 -0500

        Convert float32 constants to int32 in first stage compiler (#3371)

        * convert float32 constants in bytecode output

        * edit

        * edit

        * blocks + test

        * compare against float64 constants

        * tests check proper custom ops

        ---------

        Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com>

commit c9d7aa6
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Thu Jan 2 14:49:45 2025 -0500

    cleaned up div/mod

commit 4d9f427
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Thu Jan 2 14:45:42 2025 -0500

    address feedback and simplify division interface

commit 37b4e82
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Tue Dec 31 09:40:53 2024 -0500

    formatted

commit 1746aa8
Author: Jacob Van Buren <jvanburen@janestreet.com>
Date:   Mon Dec 30 11:37:33 2024 -0500

    updated cmm_helpers interface to be more amenable to adding other integer sizes

commit 9e7c322
Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com>
Date:   Tue Dec 31 12:01:21 2024 +0000

    Separate test for vectorizer in the CI (#3414)

    * Separate test for vectorizer in the CI

    * Remove vectorizer from "gi" CI job

commit e1a5fe4
Author: Xavier Clerc <xclerc@users.noreply.github.com>
Date:   Tue Dec 31 10:54:43 2024 +0000

    CI: simplify the regalloc jobs (#3389)

commit ab229fc
Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com>
Date:   Tue Dec 31 10:42:37 2024 +0000

    ASR 64-bit lane not available in sse instruction (#3413)

commit 8b99545
Author: Thomas Del Vecchio <127883551+tdelvecchio-jsc@users.noreply.github.com>
Date:   Mon Dec 30 14:26:48 2024 -0500

    Fix case where parser drops attributes in packed module types. (#3262)

    * Demonstrate dropped attributes in test.

    Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com>

    * Syntax error on misplaced attribute in packed module types.

    Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com>

    ---------

    Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com>

commit fe97beb
Author: Aspen Smith <aspsmith@janestreet.com>
Date:   Sat Dec 28 11:47:55 2024 -0500

    Add attributes to (unsafely) skip jkind check  (#3385)

    * Add attributes to (unsafely) skip jkind check

    Add a pair of attributes, [@@unsafe_allow_any_kind_in_intf] and
    [@@unsafe_allow_any_kind_in_impl], which if set on both the impl and the intf
    respectively, skip checking the jkind of the type in a signature against the
    jkind of the type in a struct entirely. This is a more-selective version of the
    `--allow-illegal-crossing` flag, and likely eventually subsumes it.

    Signed-off-by: Aspen Smith <aspsmith@janestreet.com>

    * Emit a warning when unsafe_allow_any_kind is added unnecessarily

    Note that this is /only/ done if the attribute is set in both signatures but not
    used - also this is a little over-sensitive (sadly) since this is done during
    sigature inclusion too. A new test covers the over-sensitivity.

    Signed-off-by: Aspen Smith <aspsmith@janestreet.com>

    ---------

    Signed-off-by: Aspen Smith <aspsmith@janestreet.com>

commit 862ced2
Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com>
Date:   Thu Dec 26 15:20:06 2024 -0500

    Add `Variant_with_null` and `Null` variant constructors (#2870)

    * `Variant_with_null`

    * `Null` tagged constructors

    * precise value kind

    * No private re-export

    ---------

    Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com>

commit 1eeed87
Author: Mark Shinwell <mshinwell@pm.me>
Date:   Thu Dec 26 15:00:49 2024 +0000

    Revert "Implement %makearray_dynamic{,_uninit}" (#3408)

    Revert "Implement %makearray_dynamic{,_uninit} (#3317)"

    This reverts commit 6da1dde.

commit 2358e09
Author: Mark Shinwell <mshinwell@pm.me>
Date:   Tue Dec 24 15:54:06 2024 +0000

    Upload core files etc upon CI failure (#3405)

commit dc6e300
Author: Xavier Clerc <xclerc@users.noreply.github.com>
Date:   Tue Dec 24 10:06:20 2024 +0100

    Fix IRC and Greedy allocators (arm64) (#3388)

commit 65c0596
Author: Max Slater <max@thenumb.at>
Date:   Mon Dec 23 16:49:37 2024 -0500

    Convert float32 constants to int32 in first stage compiler (#3371)

    * convert float32 constants in bytecode output

    * edit

    * edit

    * blocks + test

    * compare against float64 constants

    * tests check proper custom ops

    ---------

    Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vectorizer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants