Skip to content

CpuMath Enhancement: Add Debug.Assert to check matching lengths of arguments to SSE/AVX intrinsics #828

Description

@briancylui

Style changes needed to solve part of #823

Details

  • In src\Microsoft.ML.CpuMath\SseIntrinsics.cs, it may make sense to add some Debug.Asserts to check the src and dst Lengths match. However, these are internal functions that are only called from functions that guarantee the arguments are checked, so it might not be a blocking issue. It just may be some nice documentation on the expectations of these methods. And in case they get new callsites in the future.

Activity

  1. changed the title [-]Add Debug.Assert to check matching lengths of arguments to SSE/AVX intrinsics[/-] [+]CpuMath Enhancement: Add Debug.Assert to check matching lengths of arguments to SSE/AVX intrinsics[/+] on Sep 6, 2018
  2. TomFinley commented on Nov 7, 2018

    @TomFinley
    Contributor

    However, these are internal functions that are only called from functions that guarantee the arguments are checked, so it might not be a blocking issue.

    This is not a reason not to do it. Asserts are only called from debug anyway, so there is no question of them having user facing impact. They are for detecting whether we have bugs internally. (If there were any chance of them being called outside they should be checks.)

  3. rosebyte commented on Sep 3, 2026

    @rosebyte
    Member

    The intrinsic methods already assert that the requested element count fits within each source and destination span. Requiring the spans themselves to have equal lengths would be unnecessarily restrictive and does not improve correctness.

  4. locked and limited conversation to collaborators on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions