HNHacker News
TopNewBestAskShowJobs

almostgotcaught

678 karma · joined May 1, 2024

submissionscomments
almostgotcaught··on Fstrings.wtf
the output of the second example is "obvious" so i don't see the problem.
almostgotcaught··on Fstrings.wtf
> busy minds

cute pun but compared to busybodies it really hides the implication (i thought you were talking about people with adhd at first).

almostgotcaught··on Fstrings.wtf
this has nothing to do with the walrus operator and everything to do with how string.format works in python https://docs.python.org/3/library/string.html#format-string-...

Edit: someone downvoted me because they don't understand there is no walrus operator here

    print(f"{a:=10}")
almostgotcaught··on Fstrings.wtf
> String interpolation is one of those features

70% of these "wtfs" aren't about string interpolation but just python's syntax for string.format

https://docs.python.org/3/library/string.html#format-string-...

almostgotcaught··on Multiplatform Matrix Multiplication Kernels
Sure but GPUs literally have MMA engines now
almostgotcaught··on Multiplatform Matrix Multiplication Kernels
> matmult would be in transformer-optimized hardware

It is... it's in GPUs lol

> first class in torch

It is

> costing a fraction of GPUs

Why would anyone give you this for cheaper than GPUs lol?

almostgotcaught··on Multiplatform Matrix Multiplication Kernels
> Our algorithms are normally flexible on both the plane size and the line size

Congrats - I have no idea what this means lol.

almostgotcaught··on Multiplatform Matrix Multiplication Kernels
Thread, group, workgroup.

There you go you've hit basically two of 3 completely (AMD and Vulkan) and are close enough to CUDA that people would get it.

I have no idea what a plane connotes and a cube literally gives a distinct enough picture from block that I will be continuously reminding myself of the mapping.

What you did was pointless - you assigned new words to objects that you don't own and now your conceptual framework is askew from the actual underlying (true) conceptual framework.

> CubeCL to CPU

There is zero affinity between GPU programing models and multicore CPU programing models. If you don't believe me go ask the OpenMP people how they're doing supporting GPUs.

almostgotcaught··on Multiplatform Matrix Multiplication Kernels
I'm sorry this is a low brow comment but this is the dumbest thing you can do in this space:

> Unit (thread in CUDA, invocation in Vulkan/Wgpu): the smallest execution entity performing computations.

> Plane (warp in CUDA, subgroup in Vulkan/Wgpu): a group of (typically 32) units executing in lockstep and able to share data efficiently through registers.

> Cube (thread block in CUDA, workgroup in Vulkan/Wgpu): a group of units that execute on the same SM, sharing memory and able to synchronize

It's already bad enough that the vendors themselves insisted on different names but why in the bejesus would you rename these concepts and diverge from literally all existing naming conventions when you're providing middleware. Ie when using your tool I'm still going to reference NVIDIA's or AMD's docs to understand how the hardware actually works. Like do you really think otherwise - that your thing is gonna be end of the line???

FYI the word warp isn't random techno babble but is actually a very clever pun that actually fits very well conceptually:

https://en.m.wikipedia.org/wiki/Warp_and_weft

almostgotcaught··on Chrome's SSL Bypass Cheatcode
Jesus Christ thank god for this! Recently libgen ceased to be accessible because of this and I couldn't figure out any way to disable (on Firefox as well!). Bless you.
almostgotcaught··on cppyy: Automatic Python-C++ Bindings
> solves the long compile times

this only goes so far - if you try to eg bind O(10k) methods using nanobind (or pybind ofc) you will be compiling for a very long time. for example, i have a threadripper and with a single large TU (translation unit) it took about 60 minutes (because single TU <-> single thread). i had to "shard" my nanobind source to get down to a "reasonable" ~10 minutes.

almostgotcaught··on cppyy: Automatic Python-C++ Bindings
the purpose of this tool isn't to "accelerate" python or whatever - it's to bind cpp.

> AFAICT this does not quite produce true binaries, but rather interprets C++ via Cling, is that right?

yes but to be very clear: it's not designed to interpret arbitrary cpp but calls and ctors and field accesses. the point is binding. also it can use cling or clang-repl.

almostgotcaught··on Apple's MLX adding CUDA support
People on hn make up more BS than your local bar

https://www.investors.com/news/technology/apple-stock-apple-...

almostgotcaught··on Apple's MLX adding CUDA support
> CUDA backend

backend

almostgotcaught··on Zig's New Async I/O
> inject logical parameters to a segment of code is to use function parameters. You can have a complicated DI framework that involves Java class annotations and megabytes of XML, but that’s not the central idea.

so the central idea of dependency injection, a concept with a wiki of like 5000 words [1], is just pass parameters to functions...?

i guess i'm happy to accept that (i personally DGAF about DI or whatever) but it certainly means that all the people discussing DI (like yourself) are peddling snake oil...?

[1] https://en.wikipedia.org/wiki/Dependency_injection

almostgotcaught··on Zig's New Async I/O
This is like saying arithmetic is a form of calculus, the simplest form. Ie it reduces the concept (DI) to a meaningless tautology.
almostgotcaught··on Zig's New Async I/O
People in software really do have poor abilities to see the forest for the trees don't they lol
almostgotcaught··on Working through 'Writing A C Compiler'
> all other tokens should flag an error

Ie the link I posted above

almostgotcaught··on Working through 'Writing A C Compiler'
Parsers "accept" or "reject" programs. It's completely standard language.
almostgotcaught··on Working through 'Writing A C Compiler'
> I really think a big switch() (or anything that works but is simpler) would be a lot easier to understand.

It's much easier conceptually to implement this using recursion instead of a while loop and a token stack (it's basically DFS). So I disagree with you there.

> The other reason I dislike this kind of stuffs is that I have someone in the team who really likes to use patterns for every piece of code. It's kinda difficult to tell whether it is over-engineering or not, but my principle is that intuition always beats less lines of code (or DRY), unless it is absurdly more lines of code or repetition. And to test that principle you just grab a newbie and see which one makes more sense to him

I'm with you - I really don't give a shit about patterns (which was my whole original point - who cares). But that last part I don't agree with - systems code (like a parser) doesn't need to be legible to a noob. Of course we're talking about a textbook so your probably right but like I said most production parsers and AST traversals are written exactly this same way. So anyone learning this stuff hoping to get a job doing it should just get used to it.

almostgotcaught··on Working through 'Writing A C Compiler'
> why you need dynamic dispatch on a second thing

You're overindexing on maximally generic visitor pattern. If you have one type of visitor but nonetheless dispatch based on type that's still visitor pattern.

EDIT: to be honest who even cares. My initial point was why in the hell would you stop reading a book because a particular "pattern" offends you. And I'll reassert it here: who cares whether a recursive descent parser fits the exact definition of visitor pattern or not - you have members of a class that do stuff (construct AST nodes) and possibly track other data and then call other members. I usually call that a visitor class even if it's the only one that ever exists <shrug>

almostgotcaught··on Working through 'Writing A C Compiler'
> just inspect which tokens are seen and directly construct AST nodes

I'll repeat myself: this is not possible because you need to recursively construct the nodes (how else would you get a tree...).

almostgotcaught··on Working through 'Writing A C Compiler'
> you are just consuming tokens from a stream.

My guy... Do you think that parsers just like... concat tokens into tuples or something....??? Do you not understand that after lexing you have tokens (which are a "type") and AST node construction (an "operation") and that the grammar of a language is naturally a graph.... Like where else would you get the "recursion" from....

If that doesn't make sense I invite you to read some literature:

> makeAST():

> asks the tokenizer for the next token t, and then asks t to call the appropriate factory method the int token and the id token call makeLeaf(), the left parenthesis token calls makeBinOp() all other tokens should flag an error! does the above "smell" like the visitor pattern to you or not? Who are the hosts and who are the visitors?

https://www.clear.rice.edu/comp212/02-fall/labs/11/

almostgotcaught··on Working through 'Writing A C Compiler'
.... They're the same thing....
almostgotcaught··on Working through 'Writing A C Compiler'
Lolol weirdest reason to reject that book - 90% of production parsers are recursive descent parsers.
almostgotcaught··on Dict Unpacking in Python
> it's working at the source code level rather than the AST level.

this (lexing) is the only use of the codec hack - if you want to manipulate the AST you do not need this and can just to `ast.parse` and then recompile the function.

almostgotcaught··on Dict Unpacking in Python
lol i think you didn't read/understand this - the article is about **kwargs (which is sometimes sloppy) while the person you're responding to is talking about "exploding" a dict when calling a function (this does not require **kwargs at all).
almostgotcaught··on Dict Unpacking in Python
> perfect is enemy of good imo

You can't land a language feature that only sometimes works - that's absolutely horrid UX.

> can't we just copy whatever JS does?

I wasn't aware that js does this and I don't know it's implemented. So maybe I should retract my claim about compiler assistance.

almostgotcaught··on Dict Unpacking in Python
you can't do this consistently across all cases without compiler assistance (see https://doc.rust-lang.org/book/ch19-03-pattern-syntax.html or https://peps.python.org/pep-0636/#matching-builtin-classes linked below).
almostgotcaught··on jank is C++
> still is the main company behind LLVM.

lol people really say whatever comes to their mind around here don't they? I'm pretty sure all of the companies associated with these targets would strongly disagree with you

https://github.com/llvm/llvm-project/tree/main/llvm/lib/Targ...

← PreviousPage 10 of 33Next →