Vector Pascal is a
language targeted at SIMD instruction-sets such as the MMX and the AMD 3d Now
It currently supports
It has a SIMD compiler which supports parallel vector operations, loop unrolling, common sub expression removal etc. It is implemented in Java, and is available for download in source or binary.
To download the latest binary version of Vector Pascal you should click on install.jar.
For a source version click on source release
Vector Pascal is an
extended Pascal incorporating:
- Unicode support – New in version 4
- Vector Pascal extensions aimed at vector
processing. These are derived from APL and similar to the extensions provided
in Fortran90. These extensions translate to the SIMD instructions of the Athlon
and P4 etc.
- New operator extensions
- Type system extensions
- Many of the features of ISO extended Pascal (see http://www.dcs.gla.ac.uk/~wpc/reports/compilers/compilerindex/iso10206.ps ) in particular
o Schematic array types
o Extended formats of Pred and Succ
o Any type can be returned by a function
o Operators ** and POW for exponentiation and Power
o >< for set symmetric difference
o Complex numbers
o Protected parameters
o Sets of arbitrary cardinality
o For x in y do for set iteration
- Turbo Pascal features
o Units, Strings, Turbo Pascal style file operations
A comparison with other languages and implementation details are given in Vector Pascal an Array Language .
.pdf version of full manual
The code generator technology used to retarget the compiler to different platforms is documented in: Direct compilation of high level languages to multi media instructionsets . Covers use of MMX, 3DNOW and SIMD instructions to obtain parallelism. Also available as HTML
SIMD Programming Manual for Linux
The book is a programming manual for SIMD processors with special emphasis on the use of Vector Pascal
Similar vectorisation transformations for a C compiler have been done by Aart Bi k whose web page contains useful articles on vectorisation.
Vector Pascal
provides considerable speedups on vector loop based applications:
Table 1: Comparative Compiler Performances on Convolution
Program |
Implementation |
Target Processor |
Million Ops Per Second |
conv |
Vector Pascal |
Pentium + MMX |
61 |
|
Borland Pascal |
286 + 287 |
5.5 |
|
Delphi 4 |
486 |
86 |
|
DevPascal |
486 |
62 |
pconv |
Vector Pascal |
486 |
80 |
|
Vector Pascal |
Pentium + MMX |
817 |
Table 2: Pascal Compiler Performances in Million Ops per Second on
vector kernels
TEST |
DevP |
TMT |
BP 286 |
DP 4 |
VP 486 |
VP K6 |
unsigned byte
additions |
71 |
80 |
46 |
166 |
333 |
2329 |
saturated
unsigned byte additions |
55 |
57 |
38 |
110 |
225 |
2329 |
32 bit integer
additions |
85 |
59 |
47 |
285 |
349 |
635 |
16 bit integer
additions |
66 |
74 |
39 |
124 |
367 |
1165 |
real additions |
47 |
10 |
33 |
250 |
367 |
582 |
pixel additions |
49 |
46 |
23 |
98 |
188 |
2330 |
pixel
multiplications |
67 |
14 |
39 |
99 |
158 |
998 |
real dot product |
47 |
10 |
32 |
161 |
164 |
665 |
integer dot
product |
79 |
58 |
33 |
440 |
517 |
465 |
Abbreviations DevP - Dev Pascal version 1.9, TMT - TMT Pascal version 3, BP 286 - Borland Pascal compiler with 287 instructions enabled range checks off., DP 4 - Delphiversion 4, VP 486 - Vector Pascal targeted at a 486 , VP K6 - Vector Pascal targeted at an AMD K6 . Measurements on a 1Ghz Athlon.
Vector Pascal now comes with the VIPER IDE , which supports:
Syntax highlighting
Project management
Compiling and linking
Automatic translation of
Pascal to Tex using VPTEX
Both the command line and the IDE compilers contain the facility to translate
Pascal to Latex to provide a literate programming environment. Comments can
contain Latex which is passed to the latex output, pascal code is translated
using a literate programming style.
Java, gcc – for windows this should be the djgpp release, Nasm assembler and for the literate programming tool you need Latex
Since the system is in Java one binary jar file will work with either
Linux or Windows Latest binary release covering all systems is in install17_5_05.jar
An earlier version is:
http://www.dcs.gla.ac.uk/~wpc/reports/compilers/compilerindex/install.jar
Installation procedure for binary version
1. Unpack the jar file into a directory preferably called mmpc. This is done using the command:
jar -xf install.jar
2. Define an environment variable mmpcdir to point at this directory.
3. Within the mmpc directory unpack the file viper.jar
4. Make the files vpc and vp executable for linux, the corresponding windows files are vpc.bat and viper.bat.
5.
Put the mmpc directory on your path.
src.jar the most recent source package to be released
Create a directory for Vector Pascal and place the src.jar file in this directory. then unpack the archive using the command
jar -xf src.jar
Then type
make install.jar
to create the installation jar file. You then proceed
as for the binary install procedure using the install.jar file you have
created. Since the works of the compiler are all in Java and since the C code
of the run-time library is portable, the same version of the source will work
under both Windows and Linux.
The old Linux only releases start with the name linstall in directory http;//www.dcs.gla.ac.uk/~wpc/reports/compilers/compilerindex
A release of the runtime library on its own is in rtl.jar
Windows only releases start with then name winstall
Usage: vpc srcname [options] [non pascal files]
- srcname should not include the .pas extension
- output will be in an executable srcname.exe for Windows or
simply srcname for Linux
Non Pascal files
you can supply a list of .a, .o, .s or .c files that
are to be compiled and linked with your program
this is typically done to give a Pascal program access
to libraries written in another language
-A<asmfile> Allows you to specify the assembler file name used
-apu<digit><name>
specifies what code generator is to be used for
auxilliary processor n, eg:
-apu0SonyVPU0 -apu1SonyVPU1
You can specify that particular Pascal Units
in your program are to be targeted to particular
auxilliary processors. This feature is not fully
debugged yet. If several apus are listed on the
command line they must be in ascending order of APU number
-BOEHM
link with the BOEHM garbage collector which must
be installed in your gcc linkage path
-NOBOEHM default
-cpu<NAME>
specifies the code generator to be used in compiling
code. Default is Pentium, other available <NAME>s include
K6 - AMD Athlon using NASM
Opteron - AMD 64 bit architecture using gas
P3 - Intel P3 using NASM
P4 - Intel P4 using NASM
IA32 - Intel 486 using NASM
gnuPentium, gnu486 intel processors but using gas assembler
EE - for Sony PS2 Emotion Engine ( cross compiler )
NIOS - Altera NIOS ( cross compiler )
-D<symbol> Define compiler pre-processor flag for conditional compilation
-fcoff Get assembler to generate coff output
-felf Get assembler to generate elf output
-gnu generate assembler using the gnu Pentium assembler
?
-h
-help
--h
--help print this text
-inter generate an intermediate ilc file for the syntax tree
-L
-L<digit> Output a Latex listing of the program with variable levels
of detail included
-nobalance switches off cannonical re-ordering of expression trees
-o<filename> Specifies the name of the object file generated by
the assembler pass
-opt<digit> select an optimisation level from 0 to 3, default is 1
-S Generate an assembler output but do not assemble or link
-T Run in training mode, do not load any of the pre-learned
code generation tactics stored in the .vwu file
-U Generate underlines as prefix for external symbols to the
linker
-V switch on verbose mode for entire compilation
-switchon<number>
switch on verbose mode whilst generate src line <number>
-switchon<nuber>..<number>
switch on verbose mode between range of lines
in source when code generating code
-cputest do not compile a program but send test patterns
to the code generator to test what arithmetic
operations it can do and print the result to
the standard output
Keywords: Pascal,
free Compiler, MMX, Vector, SSE, 3Dnow!,APL, SIMD compiler, Matrix
Compiler Page |
wpc@dcs.gla.ac.uk
|
Teaching
exercises |