Login
You're viewing the code4lib.social public feed.
  • Nov 28, 2026, 9:59 PM

    @thesolidpixel this is all doable, and a more local change that still works with float weights and doesn't require any interface changes. It'd mostly be some added fields in the decimation info to facilitate this - you'd want to set up the permutation vectors to use for the target ISA up front, since e.g. for SSSE3/NEON you need to use byte-level permutations for this, which is not horrible but still a bit of a production to get from float element-level permutes.

    💬 2🔄 0⭐ 0

Replies

  • Nov 28, 2026, 10:03 PM

    @thesolidpixel this one should be pretty much drop-in, and it has that to recommend it, but on the flipside it has the partial vectors in the middle (at least sometimes) and doesn't help with 3D blocks at all.

    💬 0🔄 0⭐ 0
  • Nov 28, 2026, 10:03 PM

    @rygorous If you abstract the byte integer work behind a vtable-like abstraction, I don't think it's that messy in terms of inteface changes. No worse than the existing vtable stuff, and not really any worse than hauling float* arrays around for unpacked weights.

    💬 1🔄 0⭐ 0
  • Nov 28, 2026, 10:05 PM

    @rygorous I'm always a bit wary of mangled data layouts, they always end up being a bit of a pain to maintain if you don't use them a lot, so my gut feel says the integer approach is probably nicer.

    💬 0🔄 0⭐ 0
  • Nov 28, 2026, 10:08 PM

    @thesolidpixel yeah I agree, that's why I pitched it; more uniform approach that can handle all block types just feels much better.

    Might be able to reduce compute_ideal_weights for decimation to the uint8 case kinda sneakily though, the same way real sampler HW does it. :)

    💬 1🔄 0⭐ 0
  • Nov 28, 2026, 10:11 PM

    @thesolidpixel assume for a second bilinear returns just the int32 results of the weighted sum, and doesn't do the +8 or the final >>4 either; we push that into the consumer.

    That now means we can filter uint16 values by filtering uint8 twice, once for the low and once for the high bytes.

    Add low_sum + (high_sum << 8) and do the rounding and final shift, ta-da, uint16 sum.

    💬 1🔄 0⭐ 0
  • Nov 28, 2026, 10:18 PM

    @thesolidpixel in this case we'd quantize the ideal weights to something like s3.12 int16 fixed point (seems like more than enough), add a bias of 0x8000 to convert to uint16, and undo that bias after the combine of the low/high byte filtering.

    Dunno. It's also a bit strange. But that'd get rid of the float bilinears entirely

    💬 1🔄 0⭐ 0
  • Nov 28, 2026, 10:59 PM

    @rygorous Playing with the AVX512 VNNI dot implementation, as I've never had an excuse before =)

    Is there some _evil_ store forwarding cost on Xeon? Quantizer tables are written as 2x 128-bit values, and then loaded by AVX512 as a single wide load, and it kills performance.

    If I force it to load as 128-bit values and manually pack (who doesn't like a volatile pointer hack) it seems much happier, so I'm guessing the size mismatch causes the store-to-load forwarding path to crap out.

    💬 1🔄 0⭐ 0
  • Nov 28, 2026, 11:07 PM

    @thesolidpixel Vector loads that span multiple stores stall until all the constituent stores are retired. No forwarding whatsoever. Other direction (partial loads that are covered by a single wide vector store) is usually fine.

    Pretty much the same on AMD HW as well.

    💬 0🔄 0⭐ 0