Post AWrCPy1a0ROXSCwspU by niconiconi@mk.absturztau.be
(DIR) More posts by niconiconi@mk.absturztau.be
(DIR) Post #AWrBKChoPQQDIMOHGy by niconiconi@mk.absturztau.be
2023-06-19T17:56:32.722Z
1 likes, 1 repeats
I found myself in the need of 7 nested for loops :woozy_baa:
(DIR) Post #AWrBe1KwO7NRpK8rke by NeonPurpleStar@outerheaven.club
2023-06-19T18:00:10.594652Z
0 likes, 0 repeats
@niconiconi brute force = best force :blobfoxthinksmart:
(DIR) Post #AWrC0cBq37XuUnesZU by niconiconi@mk.absturztau.be
2023-06-19T18:04:14.182Z
5 likes, 1 repeats
Behold, 8 nested for loops... :woozy_baa:
(DIR) Post #AWrC9Xia2rJrEUEKsi by puniko@mk.absturztau.be
2023-06-19T18:05:51.014Z
0 likes, 0 repeats
@niconiconi :blobcatgooglyholdingitsheadinitshands: oh my god
(DIR) Post #AWrCPxBT8Bi8qaZGbY by aprzn@fedi.interestingzinc.xyz
2023-06-19T18:07:06.516963Z
0 likes, 0 repeats
@niconiconi i love it when O(n^8)
(DIR) Post #AWrCPy1a0ROXSCwspU by niconiconi@mk.absturztau.be
2023-06-19T18:08:48.265Z
0 likes, 0 repeats
@aprzn@fedi.interestingzinc.xyz The total data volume is fixed, just that there needs to be many ways to partition it to pieces.
(DIR) Post #AWrCoLgFhmjrlubCVM by lanodan@queer.hacktivis.me
2023-06-19T18:12:13.540895Z
1 likes, 0 repeats
@niconiconi I feel* like in Haskell it would be one function and then list comprehension.*haven't done any haskell since like 2016, and I'm not looking to try again, hate the syntax
(DIR) Post #AWrD8Idsi8qW8m0H32 by niconiconi@mk.absturztau.be
2023-06-19T18:16:49.017Z
0 likes, 0 repeats
@lanodan@queer.hacktivis.me I bet there are similar high-order tools in Boost. But there's no time to waste on that nerd-sniping endeavor for now...
(DIR) Post #AWrDRDnKxSNybmRt8i by sugarynips@mk.absturztau.be
2023-06-19T18:15:57.284Z
0 likes, 0 repeats
@niconiconi how do you even keep track of it in your head :akkoconfused:
(DIR) Post #AWrDRH1yvSsme4K7sm by niconiconi@mk.absturztau.be
2023-06-19T18:20:12.377Z
1 likes, 0 repeats
@sugarynips I cannot. I can only understand the individual 1D space + 1D time case, not the 4D case. But if I just repeatedly apply the 1D space + 1D time loop three times, it automatically becomes 4D and works just fine, even if I can't understand it as a whole. Abstraction and composition are powerful concepts.
(DIR) Post #AWrDahOAIVd6zzC5XU by laru@burrow.rabbits-at.work
2023-06-19T18:17:54.605372Z
0 likes, 3 repeats
@niconiconi
(DIR) Post #AWrDhuyoAHXZB4mADI by niconiconi@mk.absturztau.be
2023-06-19T18:23:16.444Z
2 likes, 2 repeats
@laru@burrow.rabbits-at.work This is the Curve25519 crypto code in Linux kernel (automatically generated, and passed formal verification).
(DIR) Post #AWrE2SLrnZNaTEM3OK by wizard@xyzzy.link
2023-06-19T18:26:57.011305Z
0 likes, 0 repeats
@niconiconi @laru the best crypto code is that which is in the same rough shape as the curve it's trying to represent
(DIR) Post #AWrEhOxtILpXq7fG1Q by Toby@snowdin.town
2023-06-19T18:29:47.796559Z
0 likes, 0 repeats
@niconiconi I’d drop the {} of the outer loops to at least save the indentation.
(DIR) Post #AWrEhQKyC1sy5zTCdM by niconiconi@mk.absturztau.be
2023-06-19T18:34:22.009Z
0 likes, 0 repeats
@Toby@snowdin.town The upstream version actually did that. But for some technical reason I didn't bother to check, the version imported into the Linux kernel version had every variable scoped, probably for C89 compliance.
(DIR) Post #AWrEuXBs1Yg37CSup6 by lanodan@queer.hacktivis.me
2023-06-19T18:35:44.418775Z
0 likes, 0 repeats
@niconiconi And well boost is pig-trusting.
(DIR) Post #AWrF8aVUUSu9SHLNpY by niconiconi@mk.absturztau.be
2023-06-19T18:39:17.920Z
1 likes, 0 repeats
@lanodan@queer.hacktivis.me The project I'm contributing to already uses Boost so it comes for free...
(DIR) Post #AWrFVmrWiexwR2iHp2 by enigmatico@mk.absturztau.be
2023-06-19T18:43:30.406Z
0 likes, 0 repeats
@niconiconi @laru@burrow.rabbits-at.work Can't that code be optimized in some way? That's a lot of products and additions.
(DIR) Post #AWrFf8hIuFPklIOJPc by julia@snug.moe
2023-06-19T18:37:52.211Z
0 likes, 0 repeats
@lanodan@queer.hacktivis.me @niconiconi@mk.absturztau.be wait what
(DIR) Post #AWrFf9vsJYfEamDSlM by lanodan@queer.hacktivis.me
2023-06-19T18:41:16.676023Z
0 likes, 0 repeats
@julia @niconiconi was too lazy to find the exact thing for "There's only so much trust you can apply to a pig".Which I guess could be compared to "Lipstick on a pig" and "pearls before swine".
(DIR) Post #AWrGBHhuwX6vyL0RZA by cafkafk@ck.cafkafk.com
2023-06-19T18:45:16.979Z
1 likes, 0 repeats
@niconiconi@mk.absturztau.be if you don't have aggresive formatters running you can always do something like for(int phaseX = 0...for(int phaseY = 0...for(int phaseZ = 0...for(int x = 0...for(int y = 0...for(int z = 0...for(int t = 0...) {...;}wonder if this is something people find stylistically horrible :woozy_baa:
(DIR) Post #AWrIZcq4EDKIMuYJdI by wakame@tech.lgbt
2023-06-19T18:58:51Z
1 likes, 0 repeats
You are both horrible :blobcatheart: @niconiconi Use a real language :blobcatpeek: @cafkafk Don't give her weird ideas :blobcat_mlem:
(DIR) Post #AWrJmHe4R7CWMBXb6G by cafkafk@ck.cafkafk.com
2023-06-19T19:18:55.914Z
1 likes, 0 repeats
@wakame@tech.lgbt @niconiconi@mk.absturztau.be I had an alternative sketch using gotos and other very beautiful things... but fine :menheraSob:
(DIR) Post #AWrJyX0f8bFzU2wrBo by niconiconi@mk.absturztau.be
2023-06-19T19:33:30.323Z
0 likes, 0 repeats
@cafkafk@ck.cafkafk.com @wakame@tech.lgbt The very purpose of this function is to flatten the data structure to make the following steps easier. Otherwise, if the main simulation engine loop accepts the X/Y/Z list separately, you can easily get 10 nested for loops. Don't ask how I know...
(DIR) Post #AWrKmFOIuxRFJriFvc by chluebi@blahaj.zone
2023-06-19T19:40:27.818Z
0 likes, 0 repeats
@enigmatico@mk.absturztau.be @niconiconi@mk.absturztau.be @laru@burrow.rabbits-at.work I think in this case compilers are optimizing exactly code like this and the benefit of letting a compiler do it is that you can have hardware specific optimization (absolutely not an expert on this)
(DIR) Post #AWrKmG8k8IaLdtRLJQ by enigmatico@mk.absturztau.be
2023-06-19T19:42:28.028Z
0 likes, 0 repeats
@chluebi@blahaj.zone @niconiconi@mk.absturztau.be @laru@burrow.rabbits-at.work Well, I'm guessing that, since this code is compiled for a lot of architectures, each processor might have a different instruction set and might or might not have instructions to accelerate this kind of operations, so maybe it's wiser to let the compiler do that job instead. Even if it's not 100% efficient. You're right.
(DIR) Post #AWrL616Hl9Ucn0iB3Q by niconiconi@mk.absturztau.be
2023-06-19T19:46:03.507Z
0 likes, 0 repeats
@enigmatico @chluebi@blahaj.zone @laru@burrow.rabbits-at.work Linux kernel already has many hand-tuned assembly versions of common crypto algorithms. This is only the generic C fallback.
(DIR) Post #AWrLY5Zshr2omfwNl2 by enigmatico@mk.absturztau.be
2023-06-19T19:51:06.667Z
0 likes, 0 repeats
@niconiconi @chluebi@blahaj.zone @laru@burrow.rabbits-at.work Oh... I see.So then it uses one of these assembly versions when compiling for the specific architecture it targets, right? And uses the fall back when there isn't anything better.
(DIR) Post #AWrMZQuCzlevAueZ96 by niconiconi@mk.absturztau.be
2023-06-19T20:02:36.048Z
0 likes, 0 repeats
@enigmatico @chluebi@blahaj.zone @laru@burrow.rabbits-at.work Also, the code generator itself was already extremely optimized for fast elliptic curve math, so usually you don't even need assembly versions. It basically just uses C itself as "portable assembly". The paper says the the CPU cycles it takes was fewer than sandy2x's assembly version, which used to be the fastest Curve25519 implementation ever published with a very unusual technique to represent numbers (which was added to the code generator).
(DIR) Post #AWrO0eXSW2TlEKYVii by niconiconi@mk.absturztau.be
2023-06-19T20:18:42.887Z
0 likes, 0 repeats
@cafkafk@ck.cafkafk.com @wakame@tech.lgbt Also, It's C++, not C (not my decision, the project was already using C++), and it also already uses Boost. So there are all sorts of baroque abstractions on the table like iterators, map(), reduce() and whatnot... So I bet there are many ways to rewrite that. But I guess the 8 nested loop is still the easiest one to understand... :woozy_baa:
(DIR) Post #AWs6Ioykpl0uo0nRYW by icedquinn@blob.cat
2023-06-20T04:35:01.384757Z
0 likes, 0 repeats
@niconiconi @laru :blobcatez: this is one of those rare things that takes some math expression and generates SIMD code or something for it isn't it