R Allan Barker science | technology | history | philosophy | curiosity |
Last updated
April 28, 2023 |
GCN GCN (Graphics Core Next} is AMD's newest
processor architecture used in GPUs and integrated
CPU/graphics processors. For anyone who enjoys the power of
lower level programming, GCN ia all new and amazingly
powerful.
GCN C compiler and assembler, extending OPENCLAt the assembly level, programming is similar to traditional CPUs but uses two interwoven instruction sets, one for vector operations and one for scalars. The two run in parallel and access common resources. Both have rich and powerful instructions like single cycle floating point transcendentals and a wide range of bit operations. Forget twiddling bits, now you can bash them. The problem is you cannot access GCN's full power. Currently the only way to program GCN gpus is
with OpenCL, which is hardware architecture independent
leaving much of GCN's power inaccessible. OpenCL doesn't
even support global synchronization, probably because it
roots come from graphics programming.
GCNC implements a traditional C/assembler programming environment that compiles directly to GCN machine code. C and/or assembly (ISA) programs are compiled to binary and run from the user's host program like OpenCL, using the OpenCL environment. Source code files can contain sections with GCNC C, ISA assembly, and AMD's IL code. Compilation is directed by simple #define statements in the host program, for which I use mingw gcc C. GCNC is based on the wonderful LCC compiler and is still under development. LCC provides very good optimization for its age but works on a different paradigm than modern compilers like AMD's openCL. While modern compilers often fully rewrite programs, GCNC optimizes the code the programmer writes. Optimization is a dual effort between programmer and compiler allowing the programmer to control the output, just like the good old days. GCNC fully opens the GCN architecture by including low level built in functions, instructions, register access, and inline assembly. The assembler implements the full GCN instruction set and does assembly level optimization to find the best GCN instruction formats. It also assembles AMD's GCN assembly code. Like C, GCNC started as a way to avoid coding in assembly yet maintain a strong link to hardware. As a project, it has been a daunting task to adapt to the full scope of a parallel environment like GCN. Currently, the pace of development is based mostly on need, although whim is often considered a need. While it implements C, complex syntax can still uncover areas that need further attention. I have now used GCNC for several substantial projects and the results have better than expected. Although AMD's openCL may write better code, the programmer's control over the output seems more important to producing very high performance code. I was never able to share this development as I had hoped but it still serves as an example of how to access GCN's low level power. See example code in below file. The GCN C compiler was developed to run on a 24 GPU system The system uses 12 water cooled AMD R295X2
dual GPU cards for 6 GPUs per computer. Computers
share 80gb RDMA links allowing one program to use all
24 GPUs.
![]() The file below shows many examples of
GCNC's syntax.
|
|
|