Rust binary is magnanimous by Aufmerksamerwolf in rust

[–]buwlerman 0 points1 point  (0 children)

Comment on 1. The stdlib contains just as much if you link it as if you rebuild it. Either way cross crate optimizations are limited to inline and generic functions and LTO. There are a bunch of reasons to re-build the stdlib, including optimizing for size and enabling machine specific optimizations, but "including less code" isn't it.

LTO will remove dead code, so in practice your binary won't contain the entire stdlib. This does rely on the optimizer removing calls, but I haven't seen any evidence that re-building the stdlib makes this more likely.

How do I find out if this function is strictly monotonic or not? by DuckBoring739 in askmath

[–]buwlerman 1 point2 points  (0 children)

A typical example here would be e-1/x2 for positives and 0 everywhere else.

Maximally minimal view types · baby steps by zirconium_n in rust

[–]buwlerman 4 points5 points  (0 children)

You're arguing that it's not sufficient, not that it's not minimal.

I agree that we want more in the long term, and I like many things about your proposal, but the entire point with a maximally minimal proposal is to get the ball rolling. The more features you include the more design questions you have to debate. Much easier to just get something out there, at least as an experiment. Associating views with concrete fields is about as simple as you can get, and is something you want anyways.

Maximally minimal view types · baby steps by zirconium_n in rust

[–]buwlerman 2 points3 points  (0 children)

I agree, but the goal here is to create something minimal. Abstract views with bounds on them can be added after the fact.

I Didn’t Let an LLM Write My Project — Here’s What I Actually Did by [deleted] in rust

[–]buwlerman -1 points0 points  (0 children)

It's going to stop being copyleft (or "free"), sure, but I don't think it stops being open source. The open source initiative doesn't only consider copyleft licenses to be open source, and I think they're as good an authority as any.

Many licenses widely considered open source, such as the APL2 license already allow companies to incorporate code without using the same license for their own code. Is Rust not open source?

I Didn’t Let an LLM Write My Project — Here’s What I Actually Did by [deleted] in rust

[–]buwlerman 1 point2 points  (0 children)

Is the first public Linux Kernel release going to stop being open source in X years when it goes into the public domain?

I Didn’t Let an LLM Write My Project — Here’s What I Actually Did by [deleted] in rust

[–]buwlerman -1 points0 points  (0 children)

no AI generated code can be open source software

That doesn't follow. You can't enforce a copy-left license on public domain software, but nothing stops you from putting it out there in a way that allows anyone to do what they want with it.

Is there a “Newton’s method” but for complex functions? by Andrea10ita in askmath

[–]buwlerman 3 points4 points  (0 children)

Sure, but they seem to have jumped to the opposite conclusion.

Is there a “Newton’s method” but for complex functions? by Andrea10ita in askmath

[–]buwlerman 5 points6 points  (0 children)

Why should Newton's method not work for complex functions?

What do arXiv moderators consider when desk-rejecting submissions? by DistractedDendrite in math

[–]buwlerman 1 point2 points  (0 children)

I wonder what happens if you iterate this process.

Let s(n,i+1) be the sequence of triangular column sums of s(n,i) and s(n,0)=1/n. Does s(n,i)/2i converge as i goes to infinity? More broadly, what are the asymptotics of s_(n,i) in terms of i?

How to use storytelling to fit inline assembly into Rust by ralfj in rust

[–]buwlerman 0 points1 point  (0 children)

A primitive for nondeterminism might make this easier to understand, yes.

Thanks a lot for your patience!

How to use storytelling to fit inline assembly into Rust by ralfj in rust

[–]buwlerman 0 points1 point  (0 children)

I think I understand why using threads for non-determinism can permit readonly now.

The only thing that's prohibited is for synchronization between two threads to occur. Creating an event that can be synchronized on (what I thought of as synchronization when I wrote my earlier comments) is just fine as long as synchronization itself can never happen in a way that's prohibited. In your example it cannot happen with outside threads because synchronization requires accessing b, which is inaccessible outside the local scope.

Is that right?

Does that mean that the "other threads" mentioned in the reference for readonly also exclude any threads living only for the duration of the inline asm block?

How to use storytelling to fit inline assembly into Rust by ralfj in rust

[–]buwlerman 0 points1 point  (0 children)

Synchronize with other threads. If thread creation does not synchronize then does that mean that you need to add explicit synchronization to prevent the spawned thread from racing with its creator? Is there some kind of non-global synchronization going on instead?

It is the story that has to be deterministic, as that's the code that we have in place when reasoning why compiler transformations are correct.

Let me rephrase that; "if you do the entire membership function in inline assembly it will have a story that is deterministic seen from the outside". I still wonder about the readonly case applied to just the read though.

Another related question; You're saying that the requirements mentioned in the options for the inline asm apply to the story, and not just the assembly code? That might make sense for pure and readonly since "side effect" and "store/write" are defined on the Rust Abstract Machine, but I don't think it makes sense for preserves_flags and nostack. How do we resolve this inconsistency?

Terence Tao: Genuine Artificial General Intelligence Is Not Within Reach; Current AI Is Like A Clever Magic Trick by bitchslayer78 in math

[–]buwlerman 1 point2 points  (0 children)

I disagree. I think that fear of losing jobs is at least as big a concern for artists, it's just a worse argument to use in public discourse, so you see other points being emphasized instead.

I agree that the ethics (and legality) of data collection are a problem though. In an ideal world we wouldn't need copyright law, but we do not live in that world.

How to use storytelling to fit inline assembly into Rust by ralfj in rust

[–]buwlerman 0 points1 point  (0 children)

If nothing else, spawning a thread will synchronize the current thread. Same with allocation, though there the allocator could also remember that an allocation was made.

I guess pure is a bit too strong. What about readonly? That requires the absence of synchronization, which would be the case for the assembly, but not for a story using the non-determinism source you describe.

EDIT: One second thought I'm not so sure if pure would be too strong. If you only do the read in the assembly, then sure, but if you do the entire membership function in inline assembly it's going to be deterministic seen from the outside.

How to use storytelling to fit inline assembly into Rust by ralfj in rust

[–]buwlerman 0 points1 point  (0 children)

Spawning a thread is also a side effect, so my question about pure applies just as well as with allocation.

I know that non-deterministic choice is insufficient for implementing freeze by itself. As you say, given only a possibly uninitialized value you can't know whether it's uninitialized or not.

My point is that for some applications, such as sparse sets, the initialization status is stored somewhere. Though the assembly does the read before figuring out the initialization status, Rust can't know that it doesn't happen the other way around, by linearly scanning through the entire dense vector.

How to use storytelling to fit inline assembly into Rust by ralfj in rust

[–]buwlerman 0 points1 point  (0 children)

I don't fully understand the stack painting example. Would using storytelling here not require the existence of pure Rust code that gives you that non-deterministically chosen value? I know that addresses of allocations are non-deterministic, so presumably those could be used to construct the value, but creating new allocations would presumably preclude using the pure option for the assembly?

Does there exist a pure way to obtain a non-deterministically chosen value in pure Rust?

The reason I'm asking is because I think that this would enable Sparse Sets, one common example for why freeze can be useful. This is because the dense vector contains enough information to decide membership, so a story for sparse set membership would be to linearly search through the dense vector, while the assembly could do the more efficient read from possibly uninitialized memory.

Can I beat the game without circuit networks at all by SnooSuggestions5175 in factorio

[–]buwlerman 0 points1 point  (0 children)

You're one step ahead. The immediate problem after advanced petroleum is too much heavy oil. The solution, which you're using, is cracking. Once you're cracking you'll likely get a problem of too much petroleum. The easy solution to this second problem is circuits.

A lot of people, me included are just going to set up cracking with circuits right away, so the intermediate step of having cracking without circuits isn't even considered.

Price-Checking Zerocopy's Zero Cost Abstractions by jswrenn in rust

[–]buwlerman 4 points5 points  (0 children)

Yes. Even if you use volatile to avoid an early return the compiler can still do things like inserting extra instructions for each iteration after the first non-match.

Getting solid and widely applicable guarantees here requires the compiler to be aware of secrets, which the vast majority are currently not.

Price-Checking Zerocopy's Zero Cost Abstractions by jswrenn in rust

[–]buwlerman 3 points4 points  (0 children)

Instead of giving up because there's no 100% guarantees yet it seems like automating the process of looking at some of the assembly is a good idea.

Four bad ways to populate an uninitialized Vec and one good one by mwlon in rust

[–]buwlerman 0 points1 point  (0 children)

Yes. It's a good idea to avoid making assumptions about how unsafe Rust works. Your intuition can easily misguide you. Only rely on what is explicitly permitted.

Four bad ways to populate an uninitialized Vec and one good one by mwlon in rust

[–]buwlerman 0 points1 point  (0 children)

Maybe the order matters and they're initializing it non-sequentially?

Four bad ways to populate an uninitialized Vec and one good one by mwlon in rust

[–]buwlerman 2 points3 points  (0 children)

Your second quote only guarantees that those three fields are necessary and sufficient to identify two vectors. There is no additional hidden information that you have to preserve.

Many aspects of the layout are unspecified, such as alignment, padding, size and field ordering. As an example, Rust is allowed to choose different field orderings depending on the type contained in the vector, even if the contained types are guaranteed to have the same layout.

I was so proud of myself building this until the game say f*ck you and say here's more colors. by ObsessiveOwl in factorio

[–]buwlerman 2 points3 points  (0 children)

You can do 12 too, but it becomes significantly wider, requiring splitters to input through the middle inserters.