Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Vulkan vs Rust

Name: Anonymous 2015-09-15 8:37

Vulkan. You know what it is. But why isn't it out yet?

Oh, what do you know, it's because Rust programmers are complaining it's difficult to interface with their FFI because of Rust's lack of unions, so these SJWs are bitching about it to try to change Vulkan's data structures to be less optimized in order to favour Rust.

Rust is fucking garbage and these rustcucks are fucking up what could be a good API.

https://www.khronos.org/message_boards/showthread.php/9649-Official-Vulkan-Feedback-API-for-High-efficiency-Graphics-and-Compute-on-GPUs?p=38243&viewfull=1#post38243

Name: Anonymous 2015-09-15 13:24

The issue here is that C bitfields have implementation-defined (and underspecified) layout
Doesn't this also holds true for structs in general? The standard only guarantees that the pointer to a struct will point to the first object of it, not where the rest of the objects will be.

typedef struct _GR_FORMAT
This is bad too, because underscore and a uppercase is reserved by the standard.

GR_UINT32
I hope these stupid types will disappear. You want a unsigned 32 bit integer? Use uint_least32_t, not this yet another typedef to int.
Plus, if I am not mistaken, the C standard only defines the behaviour when the bitfield type is of int, signed int, unsigned int and _Bool.

GR_ENUM
What the fuck?

In any case, I hope this silliness of Mantle does not exist in Vulcan.

Name: Anonymous 2015-09-15 13:42

so these SJWs
Would you please shut the fuck up about SJWs. There's 8chan if you want to rant about stupid shit.

Name: Anonymous 2015-09-15 14:56

>>3
SJW queer detected

Name: Anonymous 2015-09-15 15:11

Vulkan. You know what it is.
>>1-kun is a liar!

Name: Anonymous 2015-09-15 16:26

Why the fuck are these rust weenies whining about unions? What the fuck kind of C compatibility do you have if you can't handle unions?

Name: Anonymous 2015-09-15 20:18

Fuck Rust if it can't into unions even unsafely. Fuck it up

Name: Anonymous 2015-09-16 2:56

>>2
struct layout for plain integer types is at usually defined by an OS specific ABI standard; bitfields don't always get that level of standardization. The System V ABI is notably silent on bitfields (most implementations follow gcc, but it's not wise to rely on that). structs with plain integer types are well defined, however.

GR_UINT32 is likely there to allow support for systems that don't provide stdint.h, or need to use a different type for whatever reason (can't think of any reason for the latter though).

Name: Anonymous 2015-09-16 3:09

>>2,8
The case for GR_ENUM is similar to GR_UINT32 - although I believe enum representation is standardized by most ABIs, it is common for compilers to provide an option to change it, mostly for performance reasons. Thus it may be useful to define a separate type for these values so users can still use such optimizations in their application without breaking ABI.

Name: Anonymous 2015-09-16 18:44

>>7
Of course it can. This whole thing would be a lot simpler if a discriminating field was in the struct, then it could be wrapped easily.

The people in the thread don't realize what's going on. They think a Rust enum requires storage for all variants. It's not true, only the largest one needs storage, plus discrimination. Discrimination has to exist *somewhere*, and putting it in the struct is the safest bet.

Name: Anonymous 2015-09-16 21:02

dubs

Name: Anonymous 2015-09-17 1:09

>>10
However, putting it in the program is the fastest, and requires no double checking where the data is consumed. These properties make it preferable to a ``tagged union'', which is what you suggest, and which doesn't appear in C.

Name: Anonymous 2015-09-17 1:38

>>10,12
GR_ENUM slotObjectType;
Isn't it a tagged union? Am I missing something?

Name: Anonymous 2015-09-17 3:29

>>10,12-13
I think the issue here is that Rust's enum types can store composite data like a tagged union in C, but don't have a binary representation that's compatible with arbitrary tagged unions in C. Rust code that doesn't use the native Rust enum type works against the type system.

I think it ought to be possible to write a little unsafe wrapper code in Rust to serialize and deserialize Rust enums to and from the C types the FFI uses, but I'm not a Rust weenie. I'm sure there could be performance concerns but I'd hope rustc is smart enough to eliminate unnecessary copying and repeated checking of type tags if the programmer is a little careful.

Name: Anonymous 2015-09-17 8:59

>>1
So what? OpenGL's a hunk of shit, Vulkan's going to be a bigger hunk of shit, and Rust's going to be an even bigger hunk of shit.

People don't understand graphics, they just want to write hundreds of lines of API calls to draw a triangle so people can look at their crap and say "WOW! YOU WROTE ALL THAT? YOU MUST BE REALLY SMART!"

Yet none of these fucky GRAPHICS PROGRAMMERS can even draw a triangle on a bitmap without their SHADERZ and their OOP abstraction and their billions of gl* calls (yeah, programmable shaders don't cut down on that, by the time you have your shaders and shit set up, you've already made a couple thousand calls), all the other bullshit that goes with it.

Name: Anonymous 2015-09-17 9:01

You can't trust khronos to do a good job, just like you can't trust the GL committee to put out a decent standard. Half the shit in the later GL revisions will be obsolete in a few years anyway, because those morons can't do anything right.

Name: Anonymous 2015-09-17 9:02

And how come all you motherfuckers are obsessed with graphics programming? Haven't you grown up yet? Do you still play video games all day like a 5 year old?

Name: Anonymous 2015-09-17 9:07

You're all a bunch of 5 year olds anyway, you just fiddle around with whatever ATI or Nvidea give you. Like cudder does with his shitty intel chips. You learn all the hardware details and you think you know graphics programming, but take away the fancy graphics card and the library and you can't even draw a fucking triangle.

Name: Anonymous 2015-09-17 9:09

>>1 What is this issue anyway? Some morons who don't understand how to do data serialisation properly?

Name: Anonymous 2015-09-17 9:10

And isn't vk that social media website dikky sadkov goes on to search for people who will put their penis in his anus?

Name: Anonymous 2015-09-17 21:12

>>12
However, putting it in the program is the fastest
The part of the program I am suggesting is the struct containing the union.

>>14
I didn't actually read the code, but if that's the case there's not much more to do about it. If Rust had a stable ABI it would be mighty cool of them to use that.

>>16
I think Intel is mostly steering the Vulkan ship these days. Could be wrong. Yeah, they're part of the ARB but the other GPU manufacturers are considerably worse at it.

Name: Anonymous 2015-09-17 21:14

>>14
BTW:

Rust weenie

I like it.

Name: Anonymous 2015-09-17 21:50

>>21
I think Intel is mostly steering the Vulkan ship these days. Could be wrong. Yeah, they're part of the ARB but the other GPU manufacturers are considerably worse at it.
How so?

Name: Anonymous 2015-09-17 22:48

>>21
The program code, you fartknocker

>>14
I'd hope rustc is smart enough

oh wwwwww

Name: Anonymous 2015-09-18 1:02

>>23
AMD and nVidia have been shitting up the constellation of all the standards they care about by introducing oddball features they hope will give them an edge over the other. If Intel drives Vulkan I think we'll get a better interface out of it.

Intel's GPU stuff is better than I used to think it was. Their drivers are getting better too. Vulkan is the right thing to do. That die space isn't going to do as much good going to CPU cores as it would going to a highly parallel compute system. You don't need to run graphics on it, and with Vulkan the hope is doing GP compute on it will become more common. Of if you don't have IGP or want to shove it off to your DGPU, a cat is fine too.

>>24
The program code, you fartknocker

If you can't resolve a variant in the interface you have a big problem, like not being able to tell which variant the interface gave you.

>>14,24
oh wwwwww

I didn't comment on this the first time around but I doubt there is any ADT-specific 'smartness' built into the optimizer that would cover this. In the case at hand, the perf cost isn't so much in checking the value as it is in repackaging it, then checking it again. But maybe this could optimize very nicely:

enum FooBar {
Foo(footype),
Bar(bartype),
}

#[inline(always)]
fn check_variant(foobar: some_c_struct) -> FooBar {
match garbage.tag {
FOO => Foo(foobar.value),
BAR => Bar(foobar.value),
_ => unreachable!()
}
}

fn uses_check_variant(...) {
// ...

match check_variant(foobar) {
Foo(foo) => {...},
Bar(bar) => {...},
}

// ...
}


Since the patterns correspond well, the constructed variants don't outlive the match block and the code will be inlined, the optimizer should be able to rewrite it so that the code in the match arms replaces the variant constructors in check_variant().

You would probably also stick check_variant(); in an impl for some_c_struct so the check would just look like: match foobar.check_variant() { ... }.

What's more, I haven't kept up on the ins and outs of Deref and it is probable implementing Deref for some_c_struct could turn that match into this: match foobar { ... }. That's fucking slick, yeah?

This is a reasonable optimization, subject to the constraints above. If it doesn't exist in rustc/llvm, you could file an issue on it and be confident someone will take it seriously. This pattern should perform as well as (or better than) the C code that forces the programmer to do case analysis on the descriminant directly.

Name: Anonymous 2015-09-18 1:11

>>25
shut the fuck up and come back when you can draw a triangle you 12 year old cs player

Name: Anonymous 2015-09-18 2:48

>>26
You hate programming, we get it. Try not posting here.

Name: Anonymous 2015-09-18 4:22

>>14,25
The bigger issue is that Rust doesn't have a union structure type that can be used with #[repr(C)]. This makes it very difficult to write portable code to work with union members with different sizes and alignment requirements.

Name: Anonymous 2015-09-18 6:32

>>28
Complain here: https://github.com/rust-lang/rust/issues/5492

Once upon a time this was going to block 1.0. :(

Name: Anonymous 2015-09-18 15:11

>>25
Intel is a Jewish1, faggot-loving2, spying3 company.

_____________________________
1: Just ask Cudder
2: http://blogs.intel.com/policy/2015/08/07/intel-supports-comprehensive-federal-lgbt-non-discrimination-legislation/
3: http://libreboot.org/faq/#intelme

Name: Anonymous 2015-09-18 16:16

>>30
Yeah we know, get over it.

Name: Anonymous 2015-09-18 16:54

>>31
You don't seem to.

Name: Anonymous 2015-09-19 2:40

Dubs GET

Name: Anonymous 2015-09-19 4:44

>>29
Clearly Mozilla doesn't give a shit about this bug, or they would not have blatantly deprioritized it to hit their milestone. I'm going to guess the Servo team has as much use for unions about as the rest of the world needs Rust in its current state - not a lot.

Name: Anonymous 2015-09-19 5:19

>>25
I wrote up a test but rustc optimized a little too smart:

callq makefoo@PLT
popq %rax
jmp makebar@PLT


This is what I get for not making use of the return values. clang was still very dutiful at -O2 and went about making both calls and returning the values.

Name: Anonymous 2015-09-19 6:05

>>34
Clearly.

Or:

In the pre-1.0 era, from initial design to RFC to acceptance and implementation, this feature would probably take several months to complete. The process is more streamlined now. Since nobody has actually blocked on this issue (unless you count the Vulkan guy) it seems like postponing it was the right thing to do.

They take their time, get community feedback and put a lot of thought into their designs. Inheritance has been an issue for Servo for as long as this issue has been open and it still isn't implemented (there are tasteful mature designs and we will probably see one accepted soon.)

Have you considered what it would take to make unions work in Rust in a way that covers all the uses in C while having a clean and efficient interface in Rust without compromising soundness? The codegen is trivial but the feature design isn't.

Almost nobody is asking for this. You can work around it in C, which will be slower (and you will have to write C) but it works which I expect most are doing. This drama over Vulkan only exists because every tiny bit counts when it comes to graphics and people don't like messy solutions.

Do many people need Rust? No. People who haven't used it will continue to be happy without it until they do. At some point enough people will consider it indispensable to change the answer. By then the union issue will be resolved due to mounting pressure if nothing else. The alternative is the C ecosystem is replaced by a pure-Rust ecosystem at an incredible pace. I don't see that happening.

Name: Anonymous 2015-09-19 9:05

>>36
Inheritance has been an issue
Inheritance has been an issue
Inheritance has been an issue
It is the idiots who think like you that will turn Rust into a complete C++ clone. Nice job killing any possibility whatsoever that Rust could be seriously interesting to everyone and not just an anal toy with buzzwords.

Name: Anonymous 2015-09-19 13:46

>>25
If you can't resolve a variant in the interface you have a big problem, like not being able to tell which variant the interface gave you.

But that's wrong. The program knows, because it's only defined to accept a subset of possible variants.

Name: Anonymous 2015-09-19 15:56

>>37
Yeah, buddy. You don't really need inheritance for factorials. I heard it can make FizzBuzz more extensible though.

Name: Anonymous 2015-09-19 18:17

>>39
You don't really need inheritance for... anything, actually.

Name: Anonymous 2015-09-19 18:29

>>40
It makes FizzBuzz more extensible, buddy. Sometimes you want a Bazz or a Bizz. That inheritance dude can really flourish.

Name: Anonymous 2015-09-19 18:32

>>41
Yes, well, we have polymorphism for that.

Name: Anonymous 2015-09-19 22:44

>>35
After defining a function ('magical') to consume the values, which were computed as booleans depending on the variant, rustc produced this which is better than I feared:

callq makefoo@PLT
cmpl $1, %eax
sete %bpl
callq makebar@PLT
cmpl $1, %eax
setne %bl
movzbl %bpl, %edi
callq magical@PLT
movzbl %bl, %edi
addq $8, %rsp
popq %rbx
popq %rbp
jmp magical@PLT


I'm confident passing on the actual data in the variant would be efficient too but I don't want to read what the optimizer has to say about that, not after seeing the optimized output for calling printf!().

Name: Anonymous 2015-09-19 22:48

>>37
If that was true inheritance would already be in Rust, and it would look like C++. You might want to look into it, and the proposed solutions before making up nonsense like this.

Name: Anonymous 2015-09-21 6:52

>>44
What purpose would inheritance solve in Rust that isn't already covered by structs, enums and traits?

Name: Anonymous 2015-09-21 17:18

>>45
You're just going to post a question to a thread on page 2 and not bump it?

The big issue is keeping space conserved without blowing up the code or blowing the performance. A canonical, Servo-relevant example: https://gist.github.com/jdm/9900569

This post gives some short summaries on efficient solutions: https://internals.rust-lang.org/t/summary-of-efficient-inheritance-rfcs/494

This post gives a lot of detail on some proposed solutions: https://aturon.github.io/blog/2015/09/18/reuse/

There are so many proposals because people don't want to see it all go to shit like C++. If C unions were that pressing we would see more proposals for it too, but I haven't found any. The only use of unions in Rust would be to interface with C. Variant types are covered by enums and type punning can be done with mem::transmute.

Name: Anonymous 2015-09-21 17:24

>>46
What the fuck is "page 2"?

Name: Anonymous 2015-09-21 17:28

>>47
What the fuck is "page 2"?

Something that goes "fuck" whenever a pedant is around. It's a fucking pedant detector.Made you haver.

Name: Anonymous 2015-09-22 5:33

>>46
Only shit posting on the front page. And you saw it, didn't you?

Thanks for the links.

Name: RUST IS SHIT BABY GARBAGE 2015-09-24 16:44

RUST IS SHIT BABY GARBAGE!

Name: Anonymous 2015-09-24 18:31

>>50
Rust or bust, bud.

Name: Anonymous 2015-09-24 20:53

>>49
And you saw it, didn't you?

I did, but only because I was wondering what happened to the thread.

Name: Anonymous 2015-09-24 22:18

Swift goes the other way, using structs:

Named C unions now import as structs with fields corresponding to each field of the union. By using a struct Swift presumably preserves the ability to use a union to project a different view on the same underlying bits but I have yet to verify that Swift really does make the struct's fields use the same underlying storage.
http://www.russbishop.net/swift-2-1

It's a good idea but it wouldn't go over well in Rust.

Name: Anonymous 2015-09-25 0:03

When the union's inspiration through the workers' blood shall run,
There can be no power greater anywhere beneath the sun;
Yet what force on earth is weaker than the feeble strength of one,
But the union makes us strong.

CHORUS:
Solidarity forever,
Solidarity forever,
Solidarity forever,
For the union makes us strong.

Is there aught we hold in common with the greedy parasite,
Who would lash us into serfdom and would crush us with his might?
Is there anything left to us but to organize and fight?
For the union makes us strong.

Chorus

It is we who plowed the prairies; built the cities where they trade;
Dug the mines and built the workshops, endless miles of railroad laid;
Now we stand outcast and starving midst the wonders we have made;
But the union makes us strong.

Chorus

All the world that's owned by idle drones is ours and ours alone.
We have laid the wide foundations; built it skyward stone by stone.
It is ours, not to slave in, but to master and to own.
While the union makes us strong.

Chorus

They have taken untold millions that they never toiled to earn,
But without our brain and muscle not a single wheel can turn.
We can break their haughty power, gain our freedom when we learn
That the union makes us strong.

Chorus

In our hands is placed a power greater than their hoarded gold,
Greater than the might of armies, multiplied a thousand-fold.
We can bring to birth a new world from the ashes of the old
For the union makes us strong.

Name: Anonymous 2015-09-25 0:47

Ironically, C doesn't actually have unions either.

Name: Anonymous 2015-09-25 2:28

>>51
If you use Rust, you're either gay, or a feminists, or both.

Name: Anonymous 2015-09-25 3:36

>>56
saniv the hamster

Name: Anonymous 2015-09-25 4:19

>>56
Why are you so afraid of gays and feminists?

Name: Anonymous 2015-09-25 9:59

If you use Rust, you're either gay, or a feminists, or both.

The radio said "No, >>56. You are a feminists."

And then >>56 was gay.

Name: Anonymous 2015-09-26 5:47

>>58
Have you ever read the Good Book before? Particularily, the part about Sodom and Gomorrah?

Name: Anonymous 2015-09-26 5:50

Isn't that the one about how using your penis privilege against others is wrong?

Name: Anonymous 2015-09-26 17:30

>>59
The radio crackered,
Here, FTFY.

Name: Anonymous 2015-09-28 15:11

Rust is bad for systems programming and I don't mean ``bad'' in the Michael Jackson sense.

Name: Anonymous 2015-09-28 16:19

the great thing about rust is it has this complicated "region" type system which ensures correctness... there is no proof or even a formal model of the type system but why would you want that?

Name: Anonymous 2015-09-28 16:37

>>63
Shamone!

Name: Anonymous 2016-07-12 18:52

Thou shalt honor and respect my dubs

Name: Anonymous 2016-07-13 7:13

>>66
Respect!

Don't change these.
Name: Email:
Entire Thread Thread List