half datatype?

Manu turkeyman at gmail.com
Mon Nov 19 16:45:15 PST 2012


On 19 November 2012 22:28, Rob T <rob at ucora.com> wrote:

> On Monday, 19 November 2012 at 19:14:43 UTC, Jonathan M Davis wrote:
>
>> I'd never even _heard_ of half types before this discussion came up. But
>> then
>> again, the same goes for SIMD. And IIRC, there was some sort of function
>> attribute relating to pointers and registers that you or some other gaming
>> person was insisting on a while back, and I'd never heard of it existing
>> in
>> C++ either (as an extension or otherwise). You clearly program in a very
>> different world than I do. I care about high performance in what I do but
>> nothing on _that_ level. I suspect that this is another one of those
>> things
>> that certain folks would really like to have, and most of the rest of us
>> don't
>> have any real interest in and often know nothing about in the first
>> place. I
>> don't know that I really care whether it's added to the language though.
>> I'll
>> leave that sort of decision up to Walter.
>>
>> If anything, I just find it interesting how many low level things folks
>> like
>> you keep coming up with as must-haves or very strong wants that I've never
>> even heard of and will almost certainly never care about aside perhaps
>> from
>> how having them in D might help D catch on.
>>
>> - Jonathan M Davis
>>
>
> Anyone interested in the low precision float types, and what they are good
> for, can start here
> http://www.opengl.org/wiki/**Small_Float_Formats<http://www.opengl.org/wiki/Small_Float_Formats>
>
> I did not read through all of this thread, but my guess is that the people
> making the request for half float are mostly into game development and
> image processing.
>
> When I first started investigating D as a potential C++ replacement, I
> noted that a lot of the "visible" development (what I could see being
> publicized) was game development, so it seemed that for some reason a lot
> of the D users were also game developers, so there's perhaps something
> about D that they find attractive.
>

I've said it before, but I think D has MASSIVE potential in gaming. We are
an industry crying our for salvation from C++, but there's no possibility
to compromise on the level of access it provides us to the hardware we work
with.
D is the only language I know of that seriously threatens to offer modern
programming constructs, while still providing a syntax and compiler
technology that I can easily understand in terms of code generation and can
hit the metal when I need to.

Additionally, most games programmers have very long-term relationships with
C++ almost exclusively, so despite hating it, moving to something utterly
different like rust or whatever cool thing comes along will just never fly.
You'll never convince a team of 10-30 programmers to agree on such a change
all at once, and re-training staff in something so foreign would never be
economical.
D is again particularly interesting here because it's enough like C++ and
C# that programmers feel immediately comfortable and somewhat liberated,
but not threatened. Also, in a lot of cases, the changes to D are
relatively intuitive. The things you expect should work, often just do...
but there are still lots of rough edges too.

Gaming is a very demanding and progressive field of software, but also very
backwards at the same time. It's a sort of unity between many disciplines,
and it all comes together under a performance critical and usually embedded
umbrella, in a highly competitive and fickle industry.
You can't tell the customer to upgrade their hardware when it needs to run
on a console with an ~8 year lifecycle. As a (tech/engine) programmer, if
you don't scrutinise the code generation, calling conventions, memory
access patterns, data layout and sizes, the competition will, and their
product will appear superior. Towards the end of that 8 year cycle,
programmers are REALLY squeezing these machines. If the language doesn't
support that, then you can't compete anymore, hence we remain stuck on C++
(and there are many instances where the industry is reverting to C because
C++ is a bloaty pig).

Why game devs are interested so much in D is interesting considering the GC
> is noted to be a problem for game devs. The work of H. S. Teoh comes to
> mind with his work on a game engine, that pushed the limits of the GC and
> std lib.
>

I'll admit this is my biggest fear hands down!
That said, D is the only GC based language I know if where the GC is
relatively optional. This allows us to hedge our bets, and ease in to it
slowly as we gain confidence and understanding of how it behaves.
I don't yet have much confidence in the GC, and generally avoid using it. I
only use it for short term allocations, or non-critical-loop work which
often only survive for the scope of the function.

I don't have enough experience to make any reasonable claims about its
affect on performance, but I have seen a lot of benchmarks in this NG
though that have shown it is significantly inferior to C# and Java. That
doesn't fill me with confidence.
I do hope work is done to make it at least competitive with java/C#'s GC,
and then we'll see where we stand. C#'s GC is proven to be acceptable in at
least smaller/independent games. It's probably still not acceptable on
major AAA console titles though. We need thread-local collection... it
can't stop the world to do a collect, and I wouldn't afford more than 1ms
at any given time (and I think that's even being generous). Perhaps
incremental collection where it would stop after it reaches its allocated
time budget or something?

So my working theory is, if the GC were limited to relatively few
'convenience allocations' and the bulk of memory was still managed
manually, maybe that will lift the load to the point that the cost is
insignificant, and it will be a useful tool...?
But yes, for the moment, we use malloc and emplace.

I think this will mature only with experience and it'll help if there are
receptive ears to our needs. It's impossible for us to complain to the C#
guys about the habits of their GC and expect anyone to care. This community
offers options.
We don't HATE garbage collection, we just can't generally afford it.

 In any case, the point is that I don't think the D community should
> overlook what the game devs are doing, they're pushing D to its limits and
> are making D more visible than perhaps anyone.


This is about the only thing of significance I think we can hope to offer
back to the community. If we can use it successfully in a major commercial
game, then tell the story afterwards, I think that could bring a lot of new
interest. I hope we are able to do that.
I think maturity is reaching the point where people can realistically start
to consider taking a risk with it.

I'd love to see more movement on the android/ios front, I reckon there's a
lot more immediate potential in that space given that it's a lot less risky
and the bar isn't as high.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121120/15267d08/attachment-0001.html>


More information about the Digitalmars-d mailing list