David Mak derppening
  • Joined on 2023-08-31
derppening commented on pull request M-Labs/nac3#349 2023-11-06 15:02:34 +08:00
core: Change RHS operand of bitshift operators to int32

v6: Rebased against master, require bitshift operands to match in sign-ness.

derppening pushed to issue-336 at M-Labs/nac3 2023-11-06 14:57:26 +08:00
685475c6f5 core: Require matching operand sign-ness of bitwise shift operators
0cc6d4b82b core: Add compile-time error and runtime assertion for negative shifts
c2ab6b58ff artiq: Implement `with legacy_parallel` block
0a84f7ac31 Add CodeGenerator::gen_block and refactor to use it
fd787ca3f5 core: Remove trunc
Compare 13 commits »
derppening created pull request M-Labs/nac3#354 2023-11-06 14:43:44 +08:00
Refactor non-trivial builtin functions to be implemented by IRRT
derppening commented on pull request M-Labs/nac3#349 2023-11-06 14:12:02 +08:00
core: Change RHS operand of bitshift operators to int32

Maybe we can support both int32 and uint32?

Then:

  • we can still write "x << 2" instead of "x << uint32(2)"
  • if it's already uint32, the exception test can be removed and the…
derppening pushed to refactor/irrt-for-nontrivial-builtin-funcs at M-Labs/nac3 2023-11-06 12:57:36 +08:00
08a5050f9a core: Implement non-trivial builtin functions using IRRT
derppening created branch refactor/irrt-for-nontrivial-builtin-funcs in M-Labs/nac3 2023-11-06 12:57:36 +08:00
derppening commented on pull request M-Labs/nac3#349 2023-11-06 12:40:55 +08:00
core: Change RHS operand of bitshift operators to int32

if numpy acts up simply use _set_promotion_state to get the behavior that numpy are planning to implement.

The issue right now is that _set_promotion_state doesn't seem to affect bitwise…

derppening commented on pull request M-Labs/nac3#349 2023-11-06 12:19:50 +08:00
core: Change RHS operand of bitshift operators to int32
>>> import numpy as np
>>> np._get_promotion_state()
'legacy'
>>> np._set_promotion_state("weak")
>>> np._get_promotion_state()
'weak'
>>> np.uint64(1) << np.int32(1)
Traceback (most…
derppening commented on pull request M-Labs/nac3#349 2023-11-04 14:38:18 +08:00
core: Change RHS operand of bitshift operators to int32

It seems like this issue is documented here: https://github.com/numpy/numpy/issues/22624 and https://github.com/numpy/numpy/issues/2524.

This is because the shift number is converted as a…

derppening commented on pull request M-Labs/nac3#349 2023-11-04 14:29:33 +08:00
core: Change RHS operand of bitshift operators to int32

Apart from allowing both int32 and the LHS operand type, do you have other suggestions on how to workaround this issue?

derppening commented on pull request M-Labs/nac3#349 2023-11-04 14:21:56 +08:00
core: Change RHS operand of bitshift operators to int32

After changing it to cast to int32 I got this error:

Checking src/operators.py... Traceback (most recent call last):
  File "/home/david/programming/nac3/nac3standalone/demo/./interpret_de…
derppening commented on pull request M-Labs/nac3#349 2023-11-04 14:10:47 +08:00
core: Change RHS operand of bitshift operators to int32

accept both the type of the LHS operand and int32

That sounds like unnecessary complications. Why not just int32?

This will cause the operators.py test to require casts on all…

derppening created pull request M-Labs/nac3#353 2023-11-03 16:27:46 +08:00
Implement several unimplemented integer operations and fix casting-related bugs
derppening commented on pull request M-Labs/nac3#352 2023-11-03 16:25:55 +08:00
Revert removal of round and round64

v4: Separated casting-related fixes to a separate branch.

derppening pushed to issue-149 at M-Labs/nac3 2023-11-03 16:25:21 +08:00
derppening pushed to fix/int-ops-and-casting at M-Labs/nac3 2023-11-03 16:24:48 +08:00
9d737743c1 standalone: Add regression test for numeric primitive operations
c6b9aefe00 core: Fix int32-to-uint64 conversion
8ad09748d0 core: Fix conversion from float to unsigned types
7a5a2db842 core: Fix handling of float-to-int32 casts
447eb9c387 standalone: Fix output format string for output_uint*
Compare 6 commits »
derppening created branch fix/int-ops-and-casting in M-Labs/nac3 2023-11-03 16:24:48 +08:00
derppening commented on pull request M-Labs/nac3#352 2023-11-03 16:23:46 +08:00
Revert removal of round and round64

Actually don't merge this yet, let me break the casting changes out of this PR.

derppening commented on pull request M-Labs/nac3#348 2023-11-03 16:22:58 +08:00
Implement with legacy_parallel

v4: Rebased against master, edited docs

derppening pushed to enhance/with-legacy-parallel at M-Labs/nac3 2023-11-03 16:22:44 +08:00
f9e79a8ee7 artiq: Implement `with legacy_parallel` block
65c3d3ccaf Add CodeGenerator::gen_block and refactor to use it
7e4dab15ae standalone: Add math tests for non-number arguments
ff1fed112c core: Rework gamma/gammaln to match SciPy behavior
36a6a7b8cd core: Replace TopLevelDef comments with documentation
Compare 12 commits »