Skip to content

Disable for wasm everything that is disabled for windows and address issues with KnownTypeAst and wasm#7362

Open
palas wants to merge 6 commits into
masterfrom
disable-exes-and-tests-in-wasm
Open

Disable for wasm everything that is disabled for windows and address issues with KnownTypeAst and wasm#7362
palas wants to merge 6 commits into
masterfrom
disable-exes-and-tests-in-wasm

Conversation

@palas
Copy link
Copy Markdown
Contributor

@palas palas commented Sep 24, 2025

In the same way that they are disabled for windows, this PR disables tests and executables for wasm, since they currently don't work in wasm.

We also specify the bits of some Ints and Words so that it works when they are 32 bit by default, and thus solve an issue with wasm and KnownTypeAst.

Pre-submit checklist:

  • Branch
    • Tests are provided (if possible)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
    • Changelog fragments have been written (if appropriate)
    • Relevant tickets are mentioned in commit messages
    • Formatting, PNG optimization, etc. are updated
  • PR
    • (For external contributions) Corresponding issue exists and is linked in the description
    • Targeting master unless this is a cherry-pick backport
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested

@palas palas requested a review from zeme-wana September 24, 2025 23:54
@palas palas self-assigned this Sep 24, 2025
@palas palas added the No Changelog Required Add this to skip the Changelog Check label Sep 24, 2025
@palas palas requested review from zliu41 and removed request for zeme-wana September 25, 2025 19:55
@palas palas force-pushed the disable-exes-and-tests-in-wasm branch 2 times, most recently from 512e49a to 17c284e Compare February 6, 2026 02:00
@palas palas changed the title Disable for wasm everything that is disabled for windows Disable for wasm everything that is disabled for windows and address issues with KnownTypeAst and wasm Feb 6, 2026
toBuiltinMeaning _semvar SliceByteString =
let sliceByteStringDenotation :: Int -> Int -> BS.ByteString -> BS.ByteString
sliceByteStringDenotation start n xs = BS.take n (BS.drop start xs)
let sliceByteStringDenotation :: Int64 -> Int64 -> BS.ByteString -> BS.ByteString
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kwxm can we do these?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that is going to be run on a 32-bit system where correctness matters, then no: fromIntegral is going to silently truncate the given Int64s into Int32s.

@zliu41
Copy link
Copy Markdown
Member

zliu41 commented Feb 7, 2026

/benchmark validation

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 7, 2026

Click here to check the status of your benchmark.

@palas
Copy link
Copy Markdown
Contributor Author

palas commented Feb 7, 2026

@zliu41 There is another issue that doesn't show in the tests but it is making reading the protocol parameters from wasm fail (because of cost models apparently), and I think it is related to this:

However, we don't build on 32bit platforms anyway, so we can ignore that.
-}

This is the error I get:

RuntimeError: Expected Right, got Left: "Error in $.costModels: CMInternalWriteError \"parsing Int failed, value is either floating or will cause over or underflow 9.223372036854775807e18\""
CallStack (from HasCallStack):
  rightOrError, called at src-lib/Cardano/Wasm/Api/Tx.hs:194:25 in cardano-wasm-10.0.0.0-inplace-cardano-wasi-lib:Cardano.Wasm.Api.Tx
  estimateMinFeeImpl, called at src-wasm

Not sure why we just got this error with the latest changes? Some new cost param that exceeds 32bit int?

@zliu41
Copy link
Copy Markdown
Member

zliu41 commented Feb 7, 2026

I think it is related to this

@palas That's not a recent change. Neither is any of the other usage of Int - they've been Int for years. Does 1.58 break your wasm build, but it's fine with 1.57? I'm not sure what your wasm build does, but if that's the case, we can do a bisect.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 7, 2026

Comparing benchmark results of 'validation' on 'b7e75c9807' (base) and '0ddb89848c' (PR)

Results table
Script b7e75c9 0ddb898 Change
auction_1-1 166.2 μs 168.1 μs +1.1%
auction_1-2 542.7 μs 552.8 μs +1.9%
auction_1-3 538.1 μs 548.8 μs +2.0%
auction_1-4 215.6 μs 217.9 μs +1.1%
auction_2-1 165.8 μs 168.6 μs +1.7%
auction_2-2 541.7 μs 552.0 μs +1.9%
auction_2-3 700.4 μs 717.6 μs +2.5%
auction_2-4 538.0 μs 547.7 μs +1.8%
auction_2-5 215.4 μs 217.9 μs +1.2%
coop-1 233.4 μs 235.1 μs +0.7%
coop-2 732.1 μs 749.4 μs +2.4%
coop-3 1.978 ms 2.051 ms +3.7%
coop-4 909.6 μs 938.5 μs +3.2%
coop-5 397.7 μs 399.6 μs +0.5%
coop-6 678.2 μs 688.6 μs +1.5%
coop-7 329.1 μs 333.4 μs +1.3%
crowdfunding-success-1 197.5 μs 198.4 μs +0.5%
crowdfunding-success-2 197.4 μs 198.7 μs +0.7%
crowdfunding-success-3 197.6 μs 199.0 μs +0.7%
currency-1 216.9 μs 220.9 μs +1.8%
escrow-redeem_1-1 309.2 μs 312.5 μs +1.1%
escrow-redeem_1-2 308.8 μs 314.2 μs +1.7%
escrow-redeem_2-1 359.8 μs 363.6 μs +1.1%
escrow-redeem_2-2 358.0 μs 362.7 μs +1.3%
escrow-redeem_2-3 358.0 μs 363.3 μs +1.5%
escrow-refund-1 145.4 μs 147.0 μs +1.1%
future-increase-margin-1 217.3 μs 221.6 μs +2.0%
future-increase-margin-2 463.7 μs 473.3 μs +2.1%
future-increase-margin-3 462.9 μs 470.6 μs +1.7%
future-increase-margin-4 419.0 μs 427.0 μs +1.9%
future-increase-margin-5 704.6 μs 719.2 μs +2.1%
future-pay-out-1 221.0 μs 221.7 μs +0.3%
future-pay-out-2 463.6 μs 471.5 μs +1.7%
future-pay-out-3 462.5 μs 471.1 μs +1.9%
future-pay-out-4 704.2 μs 717.1 μs +1.8%
future-settle-early-1 217.0 μs 221.1 μs +1.9%
future-settle-early-2 462.9 μs 470.7 μs +1.7%
future-settle-early-3 463.2 μs 470.6 μs +1.6%
future-settle-early-4 535.0 μs 543.8 μs +1.6%
game-sm-success_1-1 338.5 μs 344.6 μs +1.8%
game-sm-success_1-2 186.3 μs 188.1 μs +1.0%
game-sm-success_1-3 539.2 μs 550.5 μs +2.1%
game-sm-success_1-4 215.8 μs 216.7 μs +0.4%
game-sm-success_2-1 338.7 μs 345.3 μs +1.9%
game-sm-success_2-2 186.3 μs 188.4 μs +1.1%
game-sm-success_2-3 540.7 μs 551.6 μs +2.0%
game-sm-success_2-4 215.7 μs 216.5 μs +0.4%
game-sm-success_2-5 542.0 μs 551.9 μs +1.8%
game-sm-success_2-6 215.8 μs 216.2 μs +0.2%
multisig-sm-01 342.8 μs 350.8 μs +2.3%
multisig-sm-02 334.9 μs 344.3 μs +2.8%
multisig-sm-03 336.1 μs 341.0 μs +1.5%
multisig-sm-04 338.9 μs 345.2 μs +1.9%
multisig-sm-05 472.6 μs 485.8 μs +2.8%
multisig-sm-06 341.9 μs 350.4 μs +2.5%
multisig-sm-07 336.3 μs 342.0 μs +1.7%
multisig-sm-08 335.8 μs 340.7 μs +1.5%
multisig-sm-09 337.4 μs 345.5 μs +2.4%
multisig-sm-10 472.1 μs 485.3 μs +2.8%
ping-pong-1 286.1 μs 289.4 μs +1.2%
ping-pong-2 285.6 μs 290.6 μs +1.8%
ping-pong_2-1 179.7 μs 181.3 μs +0.9%
prism-1 158.5 μs 158.9 μs +0.3%
prism-2 357.5 μs 364.2 μs +1.9%
prism-3 323.2 μs 327.8 μs +1.4%
pubkey-1 134.3 μs 140.0 μs +4.2%
stablecoin_1-1 816.3 μs 832.9 μs +2.0%
stablecoin_1-2 182.4 μs 184.3 μs +1.0%
stablecoin_1-3 936.6 μs 952.2 μs +1.7%
stablecoin_1-4 193.1 μs 194.7 μs +0.8%
stablecoin_1-5 1.193 ms 1.217 ms +2.0%
stablecoin_1-6 237.4 μs 240.7 μs +1.4%
stablecoin_2-1 815.0 μs 832.5 μs +2.1%
stablecoin_2-2 182.3 μs 183.5 μs +0.7%
stablecoin_2-3 935.9 μs 952.9 μs +1.8%
stablecoin_2-4 193.1 μs 195.0 μs +1.0%
token-account-1 167.6 μs 169.5 μs +1.1%
token-account-2 292.6 μs 297.6 μs +1.7%
uniswap-1 343.5 μs 352.4 μs +2.6%
uniswap-2 196.9 μs 199.3 μs +1.2%
uniswap-3 1.477 ms 1.509 ms +2.2%
uniswap-4 306.1 μs 308.5 μs +0.8%
uniswap-5 992.8 μs 1.016 ms +2.3%
uniswap-6 292.7 μs 294.4 μs +0.6%
vesting-1 302.2 μs 307.2 μs +1.7%
b7e75c9 0ddb898 Change
TOTAL 36.08 ms 36.76 ms +1.9%

Copy link
Copy Markdown
Contributor

@effectfully effectfully left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not safe to run UPLC on a 32-bit machine. This is discussed in Note [Integral types as Integer]. There's also

{-|
The old implementation relied on this function which is safe
*only* for 64-bit systems. There were previously safety checks to fail compilation
on other systems, but we removed them  since we only test on 64-bit systems afterall. -}
naturalToWord64Maybe :: Natural -> Maybe Word64
naturalToWord64Maybe n = fromIntegral <$> naturalToWordMaybe n

Not to mention that SatInt is Int and not Int64.

There was also something recent that breaks on a 32-bit system, but I don't remember what (UPD: it was this).

Basically, if you're doing this for shits and giggles, go ahead, but if you actually want to run UPLC on a 32-bit systems, you absolutely can't do that.

toBuiltinMeaning _semvar SliceByteString =
let sliceByteStringDenotation :: Int -> Int -> BS.ByteString -> BS.ByteString
sliceByteStringDenotation start n xs = BS.take n (BS.drop start xs)
let sliceByteStringDenotation :: Int64 -> Int64 -> BS.ByteString -> BS.ByteString
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that is going to be run on a 32-bit system where correctness matters, then no: fromIntegral is going to silently truncate the given Int64s into Int32s.

let readBitDenotation :: BS.ByteString -> Int -> BuiltinResult Bool
readBitDenotation = Bitwise.readBit
let readBitDenotation :: BS.ByteString -> Int64 -> BuiltinResult Bool
readBitDenotation bs = Bitwise.readBit bs . fromIntegral
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise.

case uni of
DefaultUniArray arg -> do
case vec Vector.!? n of
case vec Vector.!? fromIntegral n of
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise.

@effectfully
Copy link
Copy Markdown
Contributor

Oh, and the whole bitwise builtins business relies on the architecture being 64-bit, e.g.

let bigSrcPtr :: Ptr Word64 = castPtr srcPtr

Can it be safe to still use it on a 32-bit platform? I dunno, but I bet it wasn't written with that in mind, so again, if you're going to use this for something that matters, then you can't.

@effectfully
Copy link
Copy Markdown
Contributor

There was also something recent that breaks on a 32-bit system, but I don't remember what.

this

@palas
Copy link
Copy Markdown
Contributor Author

palas commented Feb 9, 2026

@effectfully @zliu41. In order to know whether cardano-wasm is feasible we would need to know which level of compatibility with 32bit can be guaranteed by Plutus. All of these are obviously possible technically, but we don't know how hard they are, so it may not be worth the effort. The options I see are, from more to less ideal:

  • Full 32bit support

It seems for UPLC, using Int64 would make the code inefficient, but there is the possibility of having conditional compilation so that it is only inefficient for 32bits, and that the code that gets compiled for 64bits doesn't change. We probably don't care about UPLC being ran efficiently in cardano-wasm, because we are not doing block production, but we do care about it being accurate, because the plan was to support transaction balancing.

  • 32bit support for everything but UPLC code execution

At least compilation used to work fine until 1.57 (included). It is no longer the case as of 1.58. But we don't know if there may be runtime issues anywhere. Maybe you can advise on this. If we can get everything but UPLC execution to work in cardano-wasm there is still the possibility of just giving up transaction balancing and supporting the rest.

  • No 32bit support

If no 32bit support can be guaranteed then we probably need to discontinue cardano-wasm because it is not even compiling right now.


In any case, I cannot really help with any of these because I don't have the expertise, this PR was just best-effort hoping it would be some small issue, but obviously it isn't.

So, which level of 32bit support can you feasibly guarantee?

Are there any other levels I am not considering?

@effectfully
Copy link
Copy Markdown
Contributor

In order to know whether cardano-wasm is feasible we would need to know which level of compatibility with 32bit can be guaranteed by Plutus.

Right now, 32-bit is explicitly precluded and you simply cannot run UPLC on anything 32-bit if you at all care about getting the correct behavior (I'm not talking about efficiency here). This is an assumption that has been built-in for a very long time, so backtracking on that now would be a massive effort, someone will have to review basically every single line of critical code to verify that it's safe to run on a 32-bit system.

If you only want things to build, I think it's fine. The benchmark results are almost certainly nonsense, those Ints are already Int64 and those fromIntegral calls should be no-op in GHC Core, but even if that somehow not the case, you still wouldn't get a slowdown in validation benchmarks across the board.

So, which level of 32bit support can you feasibly guarantee?

Well, I no longer work on the project, but the answer is 0. "It builds but running it will result in undefined behavior"

@zliu41
Copy link
Copy Markdown
Member

zliu41 commented Feb 9, 2026

32bit support for everything but UPLC code execution

What else is useful to you, if you can't use the UPLC evaluator in wasm?

probably need to discontinue cardano-wasm

It can continue but you'll need a different evaluator implementation. There are already several other UPLC evaluator implementations in other languages (e.g., talk to Lucas Rosa), some of which may support 32-bit systems better.

At least compilation used to work fine until 1.57 (included)

I'm surprised the compilation was working. I still don't know what it is in 1.58 that broke it. We can do a bisect, but given what Roman said above, do you think it's still worth doing? @palas

@palas
Copy link
Copy Markdown
Contributor Author

palas commented Feb 9, 2026

What else is useful to you, if you can't use the UPLC evaluator in wasm?

I think it is mainly the fact that it is integrated in the types of ledger. So, inspecting UPLC code, parsing of cost models within protocol parameters. There may be more things. The risk is that it may mangle some of those values in 32bits, if it makes assumptions that only hold for 64bit.

I'm surprised the compilation was working. I still don't know what it is in 1.58 that broke it. We can do a bisect, but given what Roman said above, do you think it's still worth doing?

Maybe in the long term it won't. But if we break the compilation and tests of cardano-wasm it will start to degrade and is tough getting back from there if we have any hope of it eventually working out. So if it is not too hard, it would be good to patch it so that it holds while we make a decision.

It is probably an issue with SatInt having an Int internally. I can try writing a workaround for that and see if the test passes, may be the easiest.

Is the current patch mergeable so far? I think the concerns about fromIntegral are not problematic because they talk about indexes in containers, and I really doubt there can be a container that is larger than 2^31 - 1 in the context of Plutus.

@palas
Copy link
Copy Markdown
Contributor Author

palas commented Feb 10, 2026

Nice! The last commit I pushed passes the cardano-wasm test. That is good because we can at least merge the latest plutus and not have cardano-wasm broken just yet.

I guess the implementation of multiplication may be less efficient than the previous one, but maybe even that can be fixed, there are several techniques to check for overflow, it would be a matter of measuring

@palas
Copy link
Copy Markdown
Contributor Author

palas commented Feb 10, 2026

/benchmark validation

@github-actions
Copy link
Copy Markdown
Contributor

Click here to check the status of your benchmark.

@github-actions
Copy link
Copy Markdown
Contributor

Comparing benchmark results of 'validation' on 'b7e75c980' (base) and '259154a19' (PR)

Results table
Script b7e75c9 259154a Change
auction_1-1 165.7 μs 181.5 μs +9.5%
auction_1-2 542.3 μs 589.2 μs +8.6%
auction_1-3 538.4 μs 586.7 μs +9.0%
auction_1-4 215.2 μs 229.9 μs +6.8%
auction_2-1 165.5 μs 181.5 μs +9.7%
auction_2-2 539.5 μs 583.6 μs +8.2%
auction_2-3 701.6 μs 762.3 μs +8.7%
auction_2-4 536.7 μs 583.2 μs +8.7%
auction_2-5 215.0 μs 229.7 μs +6.8%
coop-1 235.0 μs 249.8 μs +6.3%
coop-2 731.9 μs 792.8 μs +8.3%
coop-3 1.968 ms 2.198 ms +11.7%
coop-4 907.1 μs 981.1 μs +8.2%
coop-5 399.4 μs 428.7 μs +7.3%
coop-6 677.1 μs 737.9 μs +9.0%
coop-7 328.8 μs 355.9 μs +8.2%
crowdfunding-success-1 196.1 μs 211.9 μs +8.1%
crowdfunding-success-2 197.1 μs 211.2 μs +7.2%
crowdfunding-success-3 197.0 μs 210.6 μs +6.9%
currency-1 216.6 μs 235.8 μs +8.9%
escrow-redeem_1-1 308.8 μs 330.8 μs +7.1%
escrow-redeem_1-2 308.8 μs 333.0 μs +7.8%
escrow-redeem_2-1 359.4 μs 387.5 μs +7.8%
escrow-redeem_2-2 357.5 μs 388.5 μs +8.7%
escrow-redeem_2-3 357.4 μs 388.4 μs +8.7%
escrow-refund-1 144.6 μs 157.7 μs +9.1%
future-increase-margin-1 216.8 μs 236.4 μs +9.0%
future-increase-margin-2 461.7 μs 507.1 μs +9.8%
future-increase-margin-3 462.0 μs 509.1 μs +10.2%
future-increase-margin-4 420.5 μs 459.9 μs +9.4%
future-increase-margin-5 704.6 μs 765.0 μs +8.6%
future-pay-out-1 217.0 μs 236.5 μs +9.0%
future-pay-out-2 462.6 μs 508.2 μs +9.9%
future-pay-out-3 461.9 μs 508.5 μs +10.1%
future-pay-out-4 704.6 μs 758.8 μs +7.7%
future-settle-early-1 217.1 μs 235.9 μs +8.7%
future-settle-early-2 462.7 μs 508.3 μs +9.9%
future-settle-early-3 461.9 μs 510.7 μs +10.6%
future-settle-early-4 532.3 μs 580.1 μs +9.0%
game-sm-success_1-1 338.3 μs 365.3 μs +8.0%
game-sm-success_1-2 186.2 μs 202.1 μs +8.5%
game-sm-success_1-3 538.7 μs 595.7 μs +10.6%
game-sm-success_1-4 215.8 μs 235.4 μs +9.1%
game-sm-success_2-1 338.6 μs 367.3 μs +8.5%
game-sm-success_2-2 186.1 μs 202.3 μs +8.7%
game-sm-success_2-3 540.3 μs 597.2 μs +10.5%
game-sm-success_2-4 215.7 μs 235.8 μs +9.3%
game-sm-success_2-5 540.5 μs 597.0 μs +10.5%
game-sm-success_2-6 215.3 μs 235.6 μs +9.4%
multisig-sm-01 342.9 μs 370.8 μs +8.1%
multisig-sm-02 334.4 μs 365.3 μs +9.2%
multisig-sm-03 336.0 μs 370.8 μs +10.4%
multisig-sm-04 338.7 μs 367.2 μs +8.4%
multisig-sm-05 472.6 μs 515.4 μs +9.1%
multisig-sm-06 341.5 μs 370.1 μs +8.4%
multisig-sm-07 335.8 μs 365.0 μs +8.7%
multisig-sm-08 335.0 μs 364.9 μs +8.9%
multisig-sm-09 338.6 μs 369.5 μs +9.1%
multisig-sm-10 472.7 μs 514.2 μs +8.8%
ping-pong-1 285.8 μs 311.2 μs +8.9%
ping-pong-2 286.0 μs 311.3 μs +8.8%
ping-pong_2-1 179.1 μs 194.5 μs +8.6%
prism-1 158.0 μs 171.3 μs +8.4%
prism-2 357.0 μs 399.5 μs +11.9%
prism-3 323.5 μs 352.6 μs +9.0%
pubkey-1 134.4 μs 144.6 μs +7.6%
stablecoin_1-1 814.4 μs 884.6 μs +8.6%
stablecoin_1-2 181.8 μs 198.0 μs +8.9%
stablecoin_1-3 934.4 μs 1.015 ms +8.6%
stablecoin_1-4 192.7 μs 210.0 μs +9.0%
stablecoin_1-5 1.191 ms 1.298 ms +9.0%
stablecoin_1-6 237.5 μs 256.4 μs +8.0%
stablecoin_2-1 813.9 μs 882.6 μs +8.4%
stablecoin_2-2 182.4 μs 198.0 μs +8.6%
stablecoin_2-3 933.6 μs 1.013 ms +8.5%
stablecoin_2-4 192.7 μs 209.9 μs +8.9%
token-account-1 167.0 μs 183.5 μs +9.9%
token-account-2 292.0 μs 322.3 μs +10.4%
uniswap-1 344.4 μs 375.6 μs +9.1%
uniswap-2 198.1 μs 216.3 μs +9.2%
uniswap-3 1.473 ms 1.640 ms +11.3%
uniswap-4 305.4 μs 333.7 μs +9.3%
uniswap-5 993.9 μs 1.101 ms +10.8%
uniswap-6 292.1 μs 319.0 μs +9.2%
vesting-1 301.9 μs 325.6 μs +7.9%
b7e75c9 259154a Change
TOTAL 36.03 ms 39.33 ms +9.2%

let a' = toInteger a
b' = toInteger b
r = a' * b'
in if r > maxBoundInteger
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you can't do this, it's very inefficient.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably can do much better, this was just to know if it fixed the issue

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's okay:

original core:

timesSI :: SatInt -> SatInt -> SatInt
timesSI
  = \ (ds :: SatInt) (ds1 :: SatInt) ->
      case ds `cast` <Co:1> :: ... of { I# x# ->
      case ds1 `cast` <Co:1> :: ... of { I# y# ->
      case mulIntMayOflo# x# y# of {
        __DEFAULT ->
          case andI# (># x# 0#) (># y# 0#) of {
            __DEFAULT ->
              case andI# (># x# 0#) (<# y# 0#) of {
                __DEFAULT ->
                  case andI# (<# x# 0#) (># y# 0#) of {
                    __DEFAULT ->
                      case andI# (<# x# 0#) (<# y# 0#) of {
                        __DEFAULT -> overflowError;
                        1# -> maxInt `cast` <Co:2> :: ...
                      };
                    1# -> minInt `cast` <Co:2> :: ...
                  };
                1# -> minInt `cast` <Co:2> :: ...
              };
            1# -> maxInt `cast` <Co:2> :: ...
          };
        0# -> (I# (*# x# y#)) `cast` <Co:2> :: ...
      }
      }
      }

new core:

timesSI :: SatInt -> SatInt -> SatInt
timesSI
  = \ (ds :: SatInt) (ds1 :: SatInt) ->
      case ds `cast` <Co:1> :: ... of { I64# a ->
      case ds1 `cast` <Co:1> :: ... of { I64# b ->
      let {
        b_native :: Int#
        b_native = int64ToInt# b } in
      let {
        a_native :: Int#
        a_native = int64ToInt# a } in
      case mulIntMayOflo# a_native b_native of {
        __DEFAULT ->
          case ==# (># a_native 0#) (># b_native 0#) of {
            __DEFAULT -> $fBoundedInt64_$cminBound `cast` <Co:2> :: ...;
            1# -> $fBoundedInt64_$cmaxBound `cast` <Co:2> :: ...
          };
        0# ->
          (I64# (intToInt64# (*# a_native b_native))) `cast` <Co:2> :: ...
      }
      }
      }

then maxBound
else
if isTrue# ((x# <=# 0#) `andI#` (y# ># 0#))
if a < 0 && b > 0 && r > 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may also be significantly less efficient than before.

@palas palas force-pushed the disable-exes-and-tests-in-wasm branch from 1ddc59e to 11a71c8 Compare February 12, 2026 04:02
@IntersectMBO IntersectMBO deleted a comment from github-actions Bot Feb 12, 2026
@palas
Copy link
Copy Markdown
Contributor Author

palas commented Feb 12, 2026

/benchmark validation

@palas palas force-pushed the disable-exes-and-tests-in-wasm branch from 05643eb to 2a8d568 Compare May 5, 2026 19:13
@SeungheonOh
Copy link
Copy Markdown
Collaborator

/benchmark validation

@SeungheonOh
Copy link
Copy Markdown
Collaborator

/benchmark nofib

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Click here to check the status of your benchmark.

@SeungheonOh
Copy link
Copy Markdown
Collaborator

no clue where +10.1% bench result is coming from. It's about 5% faster on my local machine

@palas
Copy link
Copy Markdown
Contributor Author

palas commented May 5, 2026

let's see if the rebased version does better

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Comparing benchmark results of 'validation' on 'c8f962ae75' (base) and '2a8d568e71' (PR)

Results table
Script c8f962a 2a8d568 Change
auction_1-1 172.2 μs 185.0 μs +7.4%
auction_1-2 547.4 μs 603.9 μs +10.3%
auction_1-3 543.5 μs 603.8 μs +11.1%
auction_1-4 223.5 μs 233.8 μs +4.6%
auction_2-1 171.6 μs 185.0 μs +7.8%
auction_2-2 545.3 μs 602.3 μs +10.5%
auction_2-3 708.5 μs 786.5 μs +11.0%
auction_2-4 543.4 μs 600.2 μs +10.5%
auction_2-5 224.0 μs 234.0 μs +4.5%
coop-1 239.6 μs 255.3 μs +6.6%
coop-2 757.1 μs 807.3 μs +6.6%
coop-3 2.003 ms 2.236 ms +11.6%
coop-4 928.5 μs 987.9 μs +6.4%
coop-5 407.1 μs 432.4 μs +6.2%
coop-6 703.5 μs 740.8 μs +5.3%
coop-7 344.0 μs 356.2 μs +3.5%
crowdfunding-success-1 203.3 μs 216.4 μs +6.4%
crowdfunding-success-2 204.0 μs 217.1 μs +6.4%
crowdfunding-success-3 202.8 μs 216.8 μs +6.9%
currency-1 221.1 μs 242.7 μs +9.8%
escrow-redeem_1-1 316.7 μs 339.9 μs +7.3%
escrow-redeem_1-2 314.5 μs 339.5 μs +7.9%
escrow-redeem_2-1 367.5 μs 397.9 μs +8.3%
escrow-redeem_2-2 365.9 μs 400.3 μs +9.4%
escrow-redeem_2-3 366.1 μs 399.7 μs +9.2%
escrow-refund-1 149.9 μs 161.8 μs +7.9%
future-increase-margin-1 221.3 μs 242.1 μs +9.4%
future-increase-margin-2 473.3 μs 521.8 μs +10.2%
future-increase-margin-3 474.2 μs 523.3 μs +10.4%
future-increase-margin-4 426.2 μs 469.6 μs +10.2%
future-increase-margin-5 712.6 μs 782.9 μs +9.9%
future-pay-out-1 221.4 μs 242.5 μs +9.5%
future-pay-out-2 472.9 μs 520.5 μs +10.1%
future-pay-out-3 473.0 μs 522.1 μs +10.4%
future-pay-out-4 710.5 μs 781.2 μs +10.0%
future-settle-early-1 221.0 μs 241.9 μs +9.5%
future-settle-early-2 472.5 μs 523.0 μs +10.7%
future-settle-early-3 473.1 μs 523.8 μs +10.7%
future-settle-early-4 541.4 μs 594.4 μs +9.8%
game-sm-success_1-1 347.8 μs 373.2 μs +7.3%
game-sm-success_1-2 195.1 μs 205.8 μs +5.5%
game-sm-success_1-3 551.1 μs 609.8 μs +10.7%
game-sm-success_1-4 225.8 μs 240.2 μs +6.4%
game-sm-success_2-1 347.8 μs 373.2 μs +7.3%
game-sm-success_2-2 195.7 μs 206.0 μs +5.3%
game-sm-success_2-3 550.8 μs 611.3 μs +11.0%
game-sm-success_2-4 226.1 μs 239.9 μs +6.1%
game-sm-success_2-5 554.6 μs 609.4 μs +9.9%
game-sm-success_2-6 225.9 μs 240.4 μs +6.4%
guardrail-sorted-large 432.8 μs 510.3 μs +17.9%
guardrail-sorted-small 70.55 μs 83.96 μs +19.0%
guardrail-unsorted-large 594.7 μs 696.2 μs +17.1%
guardrail-unsorted-small 68.73 μs 81.72 μs +18.9%
multisig-sm-01 352.2 μs 377.9 μs +7.3%
multisig-sm-02 344.6 μs 371.2 μs +7.7%
multisig-sm-03 342.8 μs 376.5 μs +9.8%
multisig-sm-04 346.7 μs 375.8 μs +8.4%
multisig-sm-05 480.9 μs 525.6 μs +9.3%
multisig-sm-06 349.4 μs 377.4 μs +8.0%
multisig-sm-07 344.8 μs 370.0 μs +7.3%
multisig-sm-08 347.5 μs 370.8 μs +6.7%
multisig-sm-09 346.0 μs 376.5 μs +8.8%
multisig-sm-10 479.9 μs 524.5 μs +9.3%
ping-pong-1 290.8 μs 319.1 μs +9.7%
ping-pong-2 290.5 μs 317.6 μs +9.3%
ping-pong_2-1 184.2 μs 197.5 μs +7.2%
prism-1 162.5 μs 172.8 μs +6.3%
prism-2 368.2 μs 401.5 μs +9.0%
prism-3 333.4 μs 365.5 μs +9.6%
pubkey-1 139.2 μs 148.0 μs +6.3%
stablecoin_1-1 832.9 μs 923.0 μs +10.8%
stablecoin_1-2 191.5 μs 202.2 μs +5.6%
stablecoin_1-3 956.6 μs 1.060 ms +10.8%
stablecoin_1-4 201.7 μs 213.5 μs +5.9%
stablecoin_1-5 1.223 ms 1.369 ms +11.9%
stablecoin_1-6 248.4 μs 263.1 μs +5.9%
stablecoin_2-1 833.6 μs 922.7 μs +10.7%
stablecoin_2-2 191.1 μs 201.7 μs +5.5%
stablecoin_2-3 956.1 μs 1.066 ms +11.5%
stablecoin_2-4 201.9 μs 214.6 μs +6.3%
token-account-1 171.5 μs 186.6 μs +8.8%
token-account-2 301.0 μs 331.1 μs +10.0%
uniswap-1 347.9 μs 385.8 μs +10.9%
uniswap-2 202.5 μs 221.0 μs +9.1%
uniswap-3 1.517 ms 1.737 ms +14.5%
uniswap-4 317.8 μs 338.4 μs +6.5%
uniswap-5 1.025 ms 1.161 ms +13.3%
uniswap-6 303.7 μs 324.5 μs +6.8%
vesting-1 309.9 μs 334.0 μs +7.8%
c8f962a 2a8d568 Change
TOTAL 38.09 ms 41.78 ms +9.7%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Click here to check the status of your benchmark.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Comparing benchmark results of 'nofib' on 'c8f962ae75' (base) and '2a8d568e71' (PR)

Results table
Script c8f962a 2a8d568 Change
clausify/formula1 2.012 ms 2.243 ms +11.5%
clausify/formula2 2.708 ms 3.004 ms +10.9%
clausify/formula3 7.391 ms 8.228 ms +11.3%
clausify/formula4 16.52 ms 18.16 ms +9.9%
clausify/formula5 36.19 ms 40.08 ms +10.7%
knights/4x4 12.45 ms 13.84 ms +11.2%
knights/6x6 30.12 ms 33.28 ms +10.5%
knights/8x8 52.37 ms 57.70 ms +10.2%
primetest/05digits 6.320 ms 7.518 ms +19.0%
primetest/10digits 12.80 ms 15.20 ms +18.7%
primetest/30digits 37.15 ms 45.99 ms +23.8%
primetest/50digits 60.87 ms 75.01 ms +23.2%
queens4x4/bt 3.606 ms 3.937 ms +9.2%
queens4x4/bm 4.683 ms 5.149 ms +10.0%
queens4x4/bjbt1 4.369 ms 4.788 ms +9.6%
queens4x4/bjbt2 4.098 ms 4.483 ms +9.4%
queens4x4/fc 9.157 ms 10.04 ms +9.6%
queens5x5/bt 49.62 ms 54.27 ms +9.4%
queens5x5/bm 54.96 ms 60.02 ms +9.2%
queens5x5/bjbt1 58.09 ms 63.59 ms +9.5%
queens5x5/bjbt2 56.60 ms 61.74 ms +9.1%
queens5x5/fc 115.6 ms 126.5 ms +9.4%
c8f962a 2a8d568 Change
TOTAL 637.7 ms 714.8 ms +12.1%

@SeungheonOh
Copy link
Copy Markdown
Collaborator

/benchmark validation

@SeungheonOh
Copy link
Copy Markdown
Collaborator

/benchmark nofib

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Click here to check the status of your benchmark.

@SeungheonOh
Copy link
Copy Markdown
Collaborator

I think the culprit was plusSI and minusSI where GHC doesn't know to fully collapse bound checks. I made it so that it does old Int# operations directly when using 64 bit machine. This is slightly ugly but it retains original performance fully

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Comparing benchmark results of 'validation' on 'c8f962ae75' (base) and 'b1d89d98f7' (PR)

Results table
Script c8f962a b1d89d9 Change
auction_1-1 167.1 μs 167.8 μs +0.4%
auction_1-2 540.7 μs 552.2 μs +2.1%
auction_1-3 534.9 μs 545.5 μs +2.0%
auction_1-4 216.8 μs 217.4 μs +0.3%
auction_2-1 166.8 μs 167.7 μs +0.5%
auction_2-2 537.8 μs 550.5 μs +2.4%
auction_2-3 700.1 μs 713.1 μs +1.9%
auction_2-4 535.7 μs 545.7 μs +1.9%
auction_2-5 216.3 μs 217.6 μs +0.6%
coop-1 231.6 μs 233.3 μs +0.7%
coop-2 726.1 μs 733.2 μs +1.0%
coop-3 1.979 ms 2.039 ms +3.0%
coop-4 901.9 μs 909.0 μs +0.8%
coop-5 395.2 μs 395.7 μs +0.1%
coop-6 678.4 μs 690.7 μs +1.8%
coop-7 328.9 μs 326.9 μs -0.6%
crowdfunding-success-1 197.1 μs 197.0 μs -0.1%
crowdfunding-success-2 197.0 μs 196.7 μs -0.2%
crowdfunding-success-3 196.5 μs 197.1 μs +0.3%
currency-1 216.5 μs 220.2 μs +1.7%
escrow-redeem_1-1 308.8 μs 310.8 μs +0.6%
escrow-redeem_1-2 308.3 μs 310.9 μs +0.8%
escrow-redeem_2-1 357.7 μs 359.5 μs +0.5%
escrow-redeem_2-2 358.1 μs 359.6 μs +0.4%
escrow-redeem_2-3 359.3 μs 360.3 μs +0.3%
escrow-refund-1 144.7 μs 144.9 μs +0.1%
future-increase-margin-1 217.0 μs 220.4 μs +1.6%
future-increase-margin-2 463.2 μs 466.9 μs +0.8%
future-increase-margin-3 465.0 μs 466.5 μs +0.3%
future-increase-margin-4 416.6 μs 421.7 μs +1.2%
future-increase-margin-5 704.6 μs 710.2 μs +0.8%
future-pay-out-1 217.0 μs 220.1 μs +1.4%
future-pay-out-2 463.4 μs 465.5 μs +0.5%
future-pay-out-3 463.6 μs 465.6 μs +0.4%
future-pay-out-4 702.9 μs 711.8 μs +1.3%
future-settle-early-1 216.5 μs 219.7 μs +1.5%
future-settle-early-2 462.5 μs 466.6 μs +0.9%
future-settle-early-3 462.0 μs 465.8 μs +0.8%
future-settle-early-4 534.0 μs 541.0 μs +1.3%
game-sm-success_1-1 340.0 μs 342.4 μs +0.7%
game-sm-success_1-2 189.1 μs 187.4 μs -0.9%
game-sm-success_1-3 541.7 μs 546.5 μs +0.9%
game-sm-success_1-4 218.5 μs 216.3 μs -1.0%
game-sm-success_2-1 340.2 μs 342.2 μs +0.6%
game-sm-success_2-2 188.9 μs 187.2 μs -0.9%
game-sm-success_2-3 541.3 μs 545.5 μs +0.8%
game-sm-success_2-4 218.7 μs 216.3 μs -1.1%
game-sm-success_2-5 543.1 μs 547.5 μs +0.8%
game-sm-success_2-6 218.7 μs 216.4 μs -1.1%
guardrail-sorted-large 428.1 μs 445.1 μs +4.0%
guardrail-sorted-small 69.79 μs 70.70 μs +1.3%
guardrail-unsorted-large 585.8 μs 601.3 μs +2.6%
guardrail-unsorted-small 67.78 μs 68.95 μs +1.7%
multisig-sm-01 344.3 μs 348.3 μs +1.2%
multisig-sm-02 337.0 μs 339.2 μs +0.7%
multisig-sm-03 334.6 μs 337.9 μs +1.0%
multisig-sm-04 340.4 μs 342.0 μs +0.5%
multisig-sm-05 473.0 μs 479.3 μs +1.3%
multisig-sm-06 343.9 μs 347.4 μs +1.0%
multisig-sm-07 336.8 μs 339.5 μs +0.8%
multisig-sm-08 339.1 μs 343.3 μs +1.2%
multisig-sm-09 337.9 μs 341.5 μs +1.1%
multisig-sm-10 472.6 μs 479.9 μs +1.5%
ping-pong-1 284.7 μs 290.1 μs +1.9%
ping-pong-2 285.0 μs 290.3 μs +1.9%
ping-pong_2-1 179.5 μs 182.1 μs +1.4%
prism-1 157.1 μs 158.8 μs +1.1%
prism-2 360.1 μs 361.1 μs +0.3%
prism-3 325.0 μs 330.1 μs +1.6%
pubkey-1 134.9 μs 133.8 μs -0.8%
stablecoin_1-1 821.0 μs 835.3 μs +1.7%
stablecoin_1-2 184.8 μs 183.8 μs -0.5%
stablecoin_1-3 943.5 μs 959.5 μs +1.7%
stablecoin_1-4 195.0 μs 194.4 μs -0.3%
stablecoin_1-5 1.205 ms 1.225 ms +1.7%
stablecoin_1-6 240.8 μs 238.5 μs -1.0%
stablecoin_2-1 821.8 μs 833.5 μs +1.4%
stablecoin_2-2 184.9 μs 183.2 μs -0.9%
stablecoin_2-3 944.9 μs 958.4 μs +1.4%
stablecoin_2-4 195.2 μs 194.0 μs -0.6%
token-account-1 166.9 μs 168.6 μs +1.0%
token-account-2 293.7 μs 301.0 μs +2.5%
uniswap-1 342.1 μs 350.2 μs +2.4%
uniswap-2 197.4 μs 198.7 μs +0.7%
uniswap-3 1.497 ms 1.532 ms +2.3%
uniswap-4 307.3 μs 309.5 μs +0.7%
uniswap-5 1.004 ms 1.028 ms +2.4%
uniswap-6 293.2 μs 293.8 μs +0.2%
vesting-1 303.2 μs 306.1 μs +1.0%
c8f962a b1d89d9 Change
TOTAL 37.31 ms 37.78 ms +1.3%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Click here to check the status of your benchmark.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Comparing benchmark results of 'nofib' on 'c8f962ae75' (base) and 'b1d89d98f7' (PR)

Results table
Script c8f962a b1d89d9 Change
clausify/formula1 2.012 ms 1.976 ms -1.8%
clausify/formula2 2.712 ms 2.667 ms -1.7%
clausify/formula3 7.385 ms 7.267 ms -1.6%
clausify/formula4 16.39 ms 16.19 ms -1.2%
clausify/formula5 36.17 ms 35.55 ms -1.7%
knights/4x4 12.50 ms 12.34 ms -1.3%
knights/6x6 30.16 ms 29.75 ms -1.4%
knights/8x8 52.31 ms 51.53 ms -1.5%
primetest/05digits 6.393 ms 6.433 ms +0.6%
primetest/10digits 12.74 ms 12.44 ms -2.4%
primetest/30digits 37.72 ms 36.44 ms -3.4%
primetest/50digits 61.42 ms 59.43 ms -3.2%
queens4x4/bt 3.596 ms 3.528 ms -1.9%
queens4x4/bm 4.680 ms 4.594 ms -1.8%
queens4x4/bjbt1 4.367 ms 4.267 ms -2.3%
queens4x4/bjbt2 4.095 ms 3.999 ms -2.3%
queens4x4/fc 9.153 ms 8.965 ms -2.1%
queens5x5/bt 49.60 ms 48.69 ms -1.8%
queens5x5/bm 54.88 ms 54.11 ms -1.4%
queens5x5/bjbt1 58.11 ms 56.94 ms -2.0%
queens5x5/bjbt2 56.66 ms 55.43 ms -2.2%
queens5x5/fc 115.7 ms 113.2 ms -2.2%
c8f962a b1d89d9 Change
TOTAL 638.8 ms 625.7 ms -2.0%

@SeungheonOh
Copy link
Copy Markdown
Collaborator

/benchmark data

@SeungheonOh
Copy link
Copy Markdown
Collaborator

/benchmark nofib

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Click here to check the status of your benchmark.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Comparing benchmark results of 'data' on 'c8f962ae75' (base) and 'b1d89d98f7' (PR)

Results table
Script c8f962a b1d89d9 Change
data/conDeconI/2000 423.1 μs 432.4 μs +2.2%
data/conDeconI/4000 958.7 μs 902.2 μs -5.9%
data/conDeconI/6000 1.379 ms 1.501 ms +8.8%
data/conDeconI/8000 2.098 ms 2.103 ms +0.2%
data/conDeconI/10000 2.724 ms 2.746 ms +0.8%
data/conDeconI/12000 3.141 ms 3.426 ms +9.1%
data/conI/2000 232.5 μs 248.6 μs +6.9%
data/conI/4000 489.4 μs 521.6 μs +6.6%
data/conI/6000 767.3 μs 816.5 μs +6.4%
data/conI/8000 1.075 ms 1.138 ms +5.9%
data/conI/10000 1.430 ms 1.507 ms +5.4%
data/conI/12000 1.821 ms 1.918 ms +5.3%
data/conDeconB 449.7 μs 429.7 μs -4.4%
data/conDeconB 930.2 μs 919.7 μs -1.1%
data/conDeconB 1.449 ms 1.393 ms -3.9%
data/conDeconB 2.034 ms 2.008 ms -1.3%
data/conDeconB 2.655 ms 2.575 ms -3.0%
data/conDeconB 3.226 ms 3.155 ms -2.2%
data/conB 244.7 μs 231.4 μs -5.4%
data/conB 513.9 μs 484.5 μs -5.7%
data/conB 803.9 μs 759.6 μs -5.5%
data/conB 1.120 ms 1.062 ms -5.2%
data/conB 1.487 ms 1.415 ms -4.8%
data/conB 1.885 ms 1.794 ms -4.8%
data/conDeconB 449.6 μs 446.0 μs -0.8%
data/conDeconB 930.2 μs 900.6 μs -3.2%
data/conDeconB 1.449 ms 1.394 ms -3.8%
data/conDeconB 2.035 ms 2.086 ms +2.5%
data/conDeconB 2.652 ms 2.758 ms +4.0%
data/conDeconB 3.223 ms 3.112 ms -3.4%
data/conB 244.7 μs 231.7 μs -5.3%
data/conB 514.0 μs 485.3 μs -5.6%
data/conB 804.6 μs 760.6 μs -5.5%
data/conB 1.121 ms 1.062 ms -5.3%
data/conB 1.487 ms 1.413 ms -5.0%
data/conB 1.883 ms 1.792 ms -4.8%
data/constr 550.0 μs 564.0 μs +2.5%
data/constr 1.343 ms 1.377 ms +2.5%
data/constr 2.510 ms 2.568 ms +2.3%
data/constr 3.914 ms 3.988 ms +1.9%
data/constr 5.431 ms 5.527 ms +1.8%
data/constr 7.074 ms 7.187 ms +1.6%
data/constr 550.0 μs 564.4 μs +2.6%
data/constr 1.157 ms 1.184 ms +2.3%
data/constr 1.839 ms 1.878 ms +2.1%
data/constr 2.608 ms 2.671 ms +2.4%
data/constr 3.436 ms 3.516 ms +2.3%
data/constr 4.275 ms 4.399 ms +2.9%
data/list 463.2 μs 469.4 μs +1.3%
data/list 1.047 ms 1.068 ms +2.0%
data/list 1.845 ms 1.865 ms +1.1%
data/list 2.872 ms 2.917 ms +1.6%
data/list 3.928 ms 3.952 ms +0.6%
data/list 5.065 ms 5.094 ms +0.6%
data/list 463.4 μs 469.1 μs +1.2%
data/list 960.2 μs 978.0 μs +1.9%
data/list 1.503 ms 1.537 ms +2.3%
data/list 2.099 ms 2.149 ms +2.4%
data/list 2.723 ms 2.778 ms +2.0%
data/list 3.366 ms 3.418 ms +1.5%
c8f962a b1d89d9 Change
TOTAL 111.2 ms 112.0 ms +0.8%

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Click here to check the status of your benchmark.

@effectfully
Copy link
Copy Markdown
Contributor

Still hate this PR. It pretends that UPLC can run on a 32-bit platform, which it absolutely cannot, see this message and the one below.

What's the point to build on a 32-bit platform if you can't run there? And complicate actual critical-path code for that. Like, this project isn't a property of Intersect, it belongs to the Cardano community, and so I as a member ask: why are you complicating critical-path code to make unrunnable thing buildable? What's the motivation there?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Comparing benchmark results of 'nofib' on 'c8f962ae75' (base) and 'b1d89d98f7' (PR)

Results table
Script c8f962a b1d89d9 Change
clausify/formula1 2.033 ms 1.989 ms -2.2%
clausify/formula2 2.740 ms 2.680 ms -2.2%
clausify/formula3 7.473 ms 7.315 ms -2.1%
clausify/formula4 16.79 ms 16.26 ms -3.2%
clausify/formula5 36.73 ms 35.76 ms -2.6%
knights/4x4 12.70 ms 12.43 ms -2.1%
knights/6x6 30.79 ms 29.86 ms -3.0%
knights/8x8 53.58 ms 51.82 ms -3.3%
primetest/05digits 6.289 ms 6.474 ms +2.9%
primetest/10digits 12.63 ms 12.61 ms -0.2%
primetest/30digits 37.04 ms 37.37 ms +0.9%
primetest/50digits 59.99 ms 60.48 ms +0.8%
queens4x4/bt 3.656 ms 3.552 ms -2.8%
queens4x4/bm 4.725 ms 4.614 ms -2.3%
queens4x4/bjbt1 4.416 ms 4.286 ms -2.9%
queens4x4/bjbt2 4.148 ms 4.019 ms -3.1%
queens4x4/fc 9.265 ms 8.985 ms -3.0%
queens5x5/bt 50.42 ms 48.82 ms -3.2%
queens5x5/bm 55.56 ms 54.12 ms -2.6%
queens5x5/bjbt1 59.10 ms 57.15 ms -3.3%
queens5x5/bjbt2 57.63 ms 55.88 ms -3.0%
queens5x5/fc 117.5 ms 113.7 ms -3.2%
c8f962a b1d89d9 Change
TOTAL 645.2 ms 630.2 ms -2.3%

@SeungheonOh
Copy link
Copy Markdown
Collaborator

Honestly, I think it's best to just remove cardano-wasm's dependency to this codebase altogether and implement a separate implementation (or use existing ones that can be compiled to wasm -- check https://github.com/utxo-company/plutuz). Cardano node itself doesn't target 32bit machines so I agree with Roman's point that it is best to keep critical pass on this implementation of CEK clean and free of 32bit-specific logic.

@palas
Copy link
Copy Markdown
Contributor Author

palas commented May 12, 2026

Still hate this PR. It pretends that UPLC can run on a 32-bit platform, which it absolutely cannot, see #7362 (comment) message and the one below.

What's the point to build on a 32-bit platform if you can't run there? And complicate actual critical-path code for that. Like, this project isn't a property of Intersect, it belongs to the Cardano community, and so I as a member ask: why are you complicating critical-path code to make unrunnable thing buildable? What's the motivation there?

Even if wasm doesn't support UPLC, there is a lot more to Cardano than UPLC, and we cannot use any of it if Plutus doesn't even compile to 32 bit. I am no longer asking for full 32 bit compatibility.

Also Plutus is the only component in Cardano that doesn't compile to 32 bit. Not sure why it doesn't too, because Cardano is meant to be a universal platform, so it seems a very arbitrary decision to assume 64 bit words for the implementation of an abstract machine, but never mind that.

Haskell is a platform independent language and the only reason I see why this project is not working in 32 bits (at least for basic functionalities) is because it is using a machine dependent type Int (well, also Word) which is equivalent to Int64 in 64 bit machines. So I don't understand why, if the type is assumed to be 64 bits, it is not represented as Int64? That is what Int64 is for. Instead, the choice was using "Int but it doesn't work if it is not 64 bits", I am not sure what is the point of making this decision nor the point of not rectifying it.

Also, it should be possible to have all the changes necessary compiled conditionally to 32bit and this shouldn't affect the 64bit compilation at all. The changes I did in the 64bit SatInt path, I only proposed them because I thought they were improvement but I can remove them, and I am going to do that next.

Ultimately, it is not my choice, but not allowing Plutus to acknowledge 32bit just gives me a lot of work each time a new release of Plutus comes out, because I have to keep rebasing this PR and resolving the conflicts. And, like I say, Plutus is the only component in Cardano that has this problem.

Unfortunately, your suggestion of using an alternative implementation of Plutus doesn't help at all with compiling cardano-api to wasm, because all the components in the stack are statically linked.

@palas
Copy link
Copy Markdown
Contributor Author

palas commented May 12, 2026

and I am going to do that next.

Ah, it seems @SeungheonOh already basically did that: so basically calling int64ToInt# before and intToInt64# afterwards, the rest is the same.

I could go even further and do the types conditional too, but that would clutter much more 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No Changelog Required Add this to skip the Changelog Check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants