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

[BUG] Wrong assertion in integer_subbyte.h #1949

Open
Algy opened this issue Nov 18, 2024 · 2 comments
Open

[BUG] Wrong assertion in integer_subbyte.h #1949

Algy opened this issue Nov 18, 2024 · 2 comments
Labels
? - Needs Triage bug Something isn't working

Comments

@Algy
Copy link
Contributor

Algy commented Nov 18, 2024

Describe the bug
I got an Assertion failure while I tried 55_hopper_int4_fp8_gemm

This was due to the following incorrect assertion logic at [this line]:(

assert(value < upper_bound);
):

      [[maybe_unused]] constexpr int lower_bound = -(1 << (Bits - 1));
      [[maybe_unused]] constexpr int upper_bound = (1 << (Bits - 1)) - 1;
      assert(value >= lower_bound);
      assert(value < upper_bound); # HERE

The assertion should be assert(value <= upper_bound) as the upper_bound is inclusive.

@Algy Algy added ? - Needs Triage bug Something isn't working labels Nov 18, 2024
@foreverlms
Copy link

foreverlms commented Nov 21, 2024

I got the same error and this assertion should be what you said. I think it should be:

assert(value >= lower_bound);
assert(value < upper_bound);
:

  assert(value > lower_bound);
  assert(value <= upper_bound); 

@Algy
Copy link
Contributor Author

Algy commented Nov 21, 2024

@foreverlms the lower bound is inclusive as well since the domain of an integer is [-2**(Bits-1), 2**(Bits-1) - 1].
For example the domain of 8-bit integer (i.e., Bits=8) is [-128, 127].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
? - Needs Triage bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants