Microsoft published C++ AMP spec

Discussion in 'GPGPU Technology & Programming' started by pcchen, Feb 6, 2012.

  1. pcchen

    pcchen Moderator
    Moderator Veteran Subscriber

    Joined:
    Feb 6, 2002
    Messages:
    2,710
    Likes Received:
    83
    Location:
    Taiwan
  2. Dade

    Newcomer

    Joined:
    Dec 20, 2009
    Messages:
    206
    Likes Received:
    20
    They really seems to promote an open standard:

    Copyright License. Microsoft grants you a license under its copyrights in the specification to (a) make copies of this specification to develop your implementation of this specification, and (b) distribute portions of this specification in your implementation or your documentation of your implementation.

    (even if the following part where the license talks about patents isn't totally clear to me).

    Writing an implementation over OpenCL looks like a straightforward process.
     
  3. pcchen

    pcchen Moderator
    Moderator Veteran Subscriber

    Joined:
    Feb 6, 2002
    Messages:
    2,710
    Likes Received:
    83
    Location:
    Taiwan
    IANAL but it seems to me that they are saying is: we promise not to sue you for any patent infringement w.r.t. this spec if you don't sue us :)

    It's really important for this kind of things to be open if it really wants to be successful.
     
  4. AlexV

    AlexV Heteroscedasticitate
    Moderator Veteran

    Joined:
    Mar 15, 2005
    Messages:
    2,528
    Likes Received:
    107
    That's how I read it too, under the same restriction. Pretty sure a lawyer would find a way to twist that but:smile:

    On a separate note, I like AMP quite a bit more than I like OpenCL, in spite of it being currently more limited. It remains to be seen if any partie other than Microsoft will pick up the compiler writing mantle though. Some g++amp.exe would be useful...
     
  5. Davros

    Legend

    Joined:
    Jun 7, 2004
    Messages:
    14,302
    Likes Received:
    1,803
  6. Dade

    Newcomer

    Joined:
    Dec 20, 2009
    Messages:
    206
    Likes Received:
    20
    AMP looks promising however it doesn't seem exactly a direct OpenCL competitor. It is a bit like comparing Java Vs. Assembler. Ok, may be there isn't such a huge difference but OpenCL exposes a lot of hardware details.

    P.S. anyone remembers the old days when C++ compilers were just front-end for translating the code in C ? Having something similar from C++ AMP to OpenCL would be quite useful.
     
  7. AlexV

    AlexV Heteroscedasticitate
    Moderator Veteran

    Joined:
    Mar 15, 2005
    Messages:
    2,528
    Likes Received:
    107
    That ties into the limited aspect. That being said, I'm not that keen on the way OpenCL ends up exposing things (oh look, we're really close to the metal really...only that we're not really that close once one looks at is), and to be honest I have no confidence in its evolutionary path being anything worthwhile.

    The whole Khronos boardism means a neverending tug of war between IHVs (just look at how nicely OpenGL did as a comitee driven effort). Apple had the potential to make things right by being the ultimate shepard / vetoer, but they seem utterly incapable to do so. What AMP has going for itself is primarly the same thing that made DX succeed: whilst it is consultation driven, MS ends up calling what happens when and how. Once AMP actually ends up firmly matching the featureset exposed by DirectCompute, I'd be surprised if CL earns anything worthwhile on GPUs. For CPUs it's likely that you may end up getting better performance than whatever WARP gives you, however, to be honest, I'd rather use something like ISPC there, if one doesn't want to get to intrinsincs.

    On the other hand, this is a question of taste on my part (IMHO most of the programming language / tool warfare falls into this category, ultimately work can be done with almost anything unless it's hugely bad) so I do apologize if I end up sounding like other programming tool nazis:smile:
     
  8. rpg.314

    Veteran

    Joined:
    Jul 21, 2008
    Messages:
    4,298
    Likes Received:
    0
    Location:
    /
    Promise not to sue != License. If MS really wanted to push AMP as an open standard, then they would have given a license grant predicated on non-litigation.
     
  9. pcchen

    pcchen Moderator
    Moderator Veteran Subscriber

    Joined:
    Feb 6, 2002
    Messages:
    2,710
    Likes Received:
    83
    Location:
    Taiwan
    Well, Microsoft already promised not to sue anyone for patent infringement over any compliant implementation of this spec. I think that's good enough if all you want is to make an AMP implementation. Providing free license is probably better but I understand that it's probably too much for Microsoft to do (after all, a free license means one may be allowed to use the patent freely for other projects if he has made an implementation of AMP, and that's certainly not what Microsoft meant to do.)
     
  10. Nick

    Veteran

    Joined:
    Jan 7, 2003
    Messages:
    1,881
    Likes Received:
    17
    Location:
    Montreal, Quebec
    I don't see how there's a future for this. Every time the hardware becomes less limited there will be a new version, further fragmenting the software ecosystem. That will only stop when eventually we're be back where we started: C++.
     
  11. Dade

    Newcomer

    Joined:
    Dec 20, 2009
    Messages:
    206
    Likes Received:
    20
    In my opinion, C++/C should have native vector types (i.e float4, etc.) and other few new features that we have seen to pop up in OpenCL C/CUDA C/C++ AMP, etc.

    It would be useful also for developing classic CPU software (i.e. SSE, AVX, etc.)

    So, may be we will go back to square one but I hope with some new feature gained on the way.
     
  12. Nick

    Veteran

    Joined:
    Jan 7, 2003
    Messages:
    1,881
    Likes Received:
    17
    Location:
    Montreal, Quebec
    Why? Creating your own vector types is trivial.
    Such as?
    Any auto-vectorizing compiler worth its salt already uses vector instructions. Visual Studio 11 will finally join the ranks too.
    Aside from adding the 'restrict' keyword to the C++ standard, and perhaps adding a 'vectorize' pragma, I can't think of much that would be useful in the long run.
     
  13. rpg.314

    Veteran

    Joined:
    Jul 21, 2008
    Messages:
    4,298
    Likes Received:
    0
    Location:
    /
    Then it should be a part of C++ stdlib.

    Autovectorization is fragile.

    Lambda's perhaps....

    There are a lot of things that C++ could use. If you look outside your own niche, you'll find them useful.
     
  14. Nick

    Veteran

    Joined:
    Jan 7, 2003
    Messages:
    1,881
    Likes Received:
    17
    Location:
    Montreal, Quebec
    Should? How do you determine which composite type should become a standard? And why exactly?
    It shouldn't be any more fragile than GPGPU.
     
  15. Dade

    Newcomer

    Joined:
    Dec 20, 2009
    Messages:
    206
    Likes Received:
    20
    Yup, in all my tests, I have always seen the compilers to produce horrible and inefficient code compared to hand written SSE code.

    The only GPU compiler that had to really do some sort of autovectorization was one for AMD GPU with code for VLIW ... and one of the reasons they dropped VLIW in HD7xxx was because writing good compilers was really hard, expansive, time consuming, etc.
     
  16. hoho

    Veteran

    Joined:
    Aug 21, 2007
    Messages:
    1,218
    Likes Received:
    0
    Location:
    Estonia
    Should all trivial things be part of standard library? I don't see a reason for it.
    c++11 has them and a metric TON more of awesome stuff
     
  17. Nick

    Veteran

    Joined:
    Jan 7, 2003
    Messages:
    1,881
    Likes Received:
    17
    Location:
    Montreal, Quebec
    That's all going to change with AVX2. It has vector equivalents of every scalar instruction, so it can trivially parallelize any loop with independent iterations, identical to how GPUs do it.
     
  18. hoho

    Veteran

    Joined:
    Aug 21, 2007
    Messages:
    1,218
    Likes Received:
    0
    Location:
    Estonia
    Could be a stupid question but did you use intrinsics for the hand-written SSE or straight assembly calls? I know that at least with later versions of GCC writing code with intrinsics it'll be hard to beat the compiler in generated code efficiency. Obviously hoping it can figure out to use the SSE instructions itself is a whole different matter :)
     
  19. Dade

    Newcomer

    Joined:
    Dec 20, 2009
    Messages:
    206
    Likes Received:
    20
    Intrinsics, for instance to do the intersection of a ray with 4 triangles in a single shot, ray/4xBounding box, etc. GCC can not even start to figure out how to auto-vectorize the code written in plain C++. Indeed, it isn't really a GCC fault, you need native float4 data type to write something where SSE/AVX can be used.

    Side note: it is also noticeable how hard is to read the code written with intrinsics compared to something written with native float4 (for instance with OpenCL C). From my point of view, this alone, could be seen as a good reason to introduce native vector data types.
     
  20. RecessionCone

    Regular Subscriber

    Joined:
    Feb 27, 2010
    Messages:
    496
    Likes Received:
    174
    What is the AVX2 vector equivalent of a store instruction? AFAIK, it doesn't exist.

    AVX2 is a step forward, and will help vectorizing compilers, but it still isn't as good a compile target as either GPUs or Larrabee.
     

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...