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

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.

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