aboutsummaryrefslogtreecommitdiff
path: root/runtime/tools
diff options
context:
space:
mode:
authorAndrey Churbanov <Andrey.Churbanov@intel.com>2015-01-16 12:54:51 +0000
committerAndrey Churbanov <Andrey.Churbanov@intel.com>2015-01-16 12:54:51 +0000
commit50c666a9bd264f1e2673d106e4dffae3cc58a41d (patch)
tree6a398343c8c4e6425e578807bc1440d766b4a74c /runtime/tools
parent7680d2964f40fac0bbe07f624d369e388985d9e5 (diff)
cleanup changes of building for Intel(R) Many Integrated Core Architecture
git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@226271 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtime/tools')
-rwxr-xr-xruntime/tools/build.pl36
-rwxr-xr-xruntime/tools/check-depends.pl10
-rwxr-xr-xruntime/tools/check-execstack.pl10
-rwxr-xr-xruntime/tools/check-instruction-set.pl62
-rwxr-xr-xruntime/tools/check-tools.pl3
-rw-r--r--runtime/tools/common.inc22
-rwxr-xr-xruntime/tools/extract-objects.pl2
-rw-r--r--runtime/tools/lib/Platform.pm75
-rwxr-xr-xruntime/tools/message-converter.pl2
-rwxr-xr-xruntime/tools/required-objects.pl19
-rw-r--r--runtime/tools/src/common-defs.mk18
-rw-r--r--runtime/tools/src/common-rules.mk12
-rw-r--r--runtime/tools/src/common-tools.mk10
13 files changed, 175 insertions, 106 deletions
diff --git a/runtime/tools/build.pl b/runtime/tools/build.pl
index 0056498..64c35bd 100755
--- a/runtime/tools/build.pl
+++ b/runtime/tools/build.pl
@@ -55,26 +55,22 @@ my %makefiles = (
# * params: A hash of possible option values. "*" denotes default option value. For example,
# if "versio" option is not specified, "--version=5" will be used implicitly.
# * suffux: Only for extra options. Subroutine returning suffix for build and output
-# directories.
+# directories. ** When you do not want an option to be part of the suffix, set its base=2
my $opts = {
"target" => { targets => "", base => 1, parms => { map( ( $_ => "" ), keys( %makefiles ) ), rtl => "*" }, },
"version" => { targets => "rtl", base => 1, parms => { 5 => "*", 4 => "" }, },
"lib-type" => { targets => "rtl", base => 1, parms => { normal => "*", stubs => "" }, },
"link-type" => { targets => "rtl", base => 1, parms => { dynamic => "*", static => "" }, },
- "target-compiler" => { targets => "rtl,dsl", base => 0, parms => { 12 => "*", 11 => "" }, suffix => sub { $_[ 0 ]; } },
"mode" => { targets => "rtl,dsl,timelimit", base => 0, parms => { release => "*", diag => "", debug => "" }, suffix => sub { substr( $_[ 0 ], 0, 3 ); } },
"omp-version" => { targets => "rtl", base => 0, parms => { 40 => "*", 30 => "", 25 => "" }, suffix => sub { $_[ 0 ]; } },
"coverage" => { targets => "rtl", base => 0, parms => { off => "*", on => "" }, suffix => sub { $_[ 0 ] eq "on" ? "c1" : "c0"; } },
- "tcheck" => { targets => "rtl", base => 0, parms => { 0 => "*", 1 => "", 2 => "" }, suffix => sub { "t" . $_[ 0 ]; } },
- "mic-arch" => { targets => "rtl", base => 0, parms => { knf => "*", knc => "", knl => "" }, suffix => sub { $_[ 0 ]; } },
- "mic-os" => { targets => "rtl", base => 0, parms => { bsd => "*", lin => "" }, suffix => sub { $_[ 0 ]; } },
- "mic-comp" => { targets => "rtl", base => 0, parms => { native => "*", offload => "" }, suffix => sub { substr( $_[ 0 ], 0, 3 ); } },
+ "stats" => { targets => "rtl", base => 0, parms => { off => "*", on => "" }, suffix => sub { $_[ 0 ] eq "on" ? "s1" : "s0"; } },
};
my $synonyms = {
"debug" => [ qw{ dbg debg } ],
};
# This array specifies order of options to process, so it cannot be initialized with keys( %$opts ).
-my @all_opts = qw{ target version lib-type link-type target-compiler mode omp-version coverage tcheck mic-arch mic-os mic-comp };
+my @all_opts = qw{ target version lib-type link-type mode omp-version coverage stats };
# This is the list of base options.
my @base_opts = grep( $opts->{ $_ }->{ base } == 1, @all_opts );
# This is the list of extra options.
@@ -241,7 +237,7 @@ sub enqueue_jobs($$@) {
# Shortened version of @extra -- only non-default values.
my $suffix = ( @extra ? "." . join( ".", @extra ) : "" );
my $knights = index( $suffix, "kn" ) - 1;
- if ( $target_platform !~ "lrb" and $knights > 0 ) {
+ if ( $target_arch !~ "mic" and $knights > 0 ) {
$suffix = substr( $suffix, 0, $knights );
}
my $suf = ( @ex ? "." . join( ".", @ex ) : "" );
@@ -256,9 +252,7 @@ sub enqueue_jobs($$@) {
make_args => [
"os=" . $target_os,
"arch=" . $target_arch,
- "MIC_OS=" . $set->{ "mic-os" },
- "MIC_ARCH=" . $set->{ "mic-arch" },
- "MIC_COMP=" . $set->{ "mic-comp" },
+ "MIC_ARCH=" . $target_mic_arch,
"date=" . Build::tstr( $Build::start ),
"TEST_DEPS=" . ( $test_deps ? "on" : "off" ),
"TEST_TOUCH=" . ( $test_touch ? "on" : "off" ),
@@ -274,10 +268,9 @@ sub enqueue_jobs($$@) {
"LIB_TYPE=" . substr( $set->{ "lib-type" }, 0, 4 ),
"LINK_TYPE=" . substr( $set->{ "link-type" }, 0, 4 ),
"OMP_VERSION=" . $set->{ "omp-version" },
- "USE_TCHECK=" . $set->{ tcheck },
"VERSION=" . $set->{ version },
- "TARGET_COMPILER=" . $set->{ "target-compiler" },
"suffix=" . $suf,
+ "stats=" . $set->{ stats },
@goals,
],
build_dir => $build_dir
@@ -371,29 +364,20 @@ Use specified string as default answer to all questions.
=item B<--architecture=>I<arch>
Specify target architecture to build. Default is architecture of host machine. I<arch> can be C<32>,
-C<32e>, or one of known aliases like C<IA32>.
+C<32e>, C<mic>, or one of known aliases like C<IA32>.
If architecture is not specified explicitly, value of LIBOMP_ARCH environment variable is used.
If LIBOMP_ARCH is not defined, host architecture detected.
=item B<--os=>I<os>
-Specify target OS. Default is OS of host machine. I<os> can be C<lin>, C<lrb>, C<mac>, C<win>,
+Specify target OS. Default is OS of host machine. I<os> can be C<lin>, C<mac>, C<win>,
or one of known aliases like C<Linux>, C<WinNT>, etc.
-=item B<--mic-os=>I<os>
-
-Specify OS on Intel(R) Many Integrated Core Architecture card. Default is C<bsd>. I<os> can be C<bsd>, C<lin>.
-
=item B<--mic-arch=>I<arch>
Specify architecture of Intel(R) Many Integrated Core Architecture card. Default is C<knf>. I<arch> can be C<knf>, C<knc>, C<knl>.
-=item B<--mic-comp=>I<compiler-type>
-
-Specify whether the Intel(R) Many Integrated Core Compiler is native or offload. Default is C<native>.
-I<compiler-type> can be C<native> or C<offload>.
-
=item B<-->[B<no->]B<test-deps>
Enable or disable C<test-deps>. The test runs in any case, but result of disabled test is ignored.
@@ -445,10 +429,6 @@ Mode controls 3 features:
code optimization o o
---------------------------------------------------
-=item B<--target-compiler=>I<version>
-
-Build files for specified target compiler, C<11> or C<12>.
-
=back
=item Shortcuts
diff --git a/runtime/tools/check-depends.pl b/runtime/tools/check-depends.pl
index 2a8de56..ce97230 100755
--- a/runtime/tools/check-depends.pl
+++ b/runtime/tools/check-depends.pl
@@ -95,10 +95,16 @@ sub get_deps_ldd($) {
sub get_deps_readelf($) {
my $file = shift ( @_ );
- my $tool = "readelf";
+ my $tool;
my @bulk;
my @deps;
+ if($target_arch eq "mic") {
+ $tool = "x86_64-k1om-linux-readelf";
+ } else {
+ $tool = "readelf";
+ }
+
execute( [ $tool, "-d", $file ], -stdout => \@bulk );
debug( @bulk, "(eof)" );
@@ -346,7 +352,7 @@ if ( not -e $lib ){
# Select appropriate get_deps implementation.
if ( 0 ) {
-} elsif ( $target_os eq "lin" or $target_os eq "lrb" ) {
+} elsif ( $target_os eq "lin" ) {
*get_deps = \*get_deps_readelf;
} elsif ( $target_os eq "mac" ) {
*get_deps = \*get_deps_otool;
diff --git a/runtime/tools/check-execstack.pl b/runtime/tools/check-execstack.pl
index f1417c7..1f09eab 100755
--- a/runtime/tools/check-execstack.pl
+++ b/runtime/tools/check-execstack.pl
@@ -18,6 +18,7 @@ use FindBin;
use lib "$FindBin::Bin/lib";
use tools;
+use Platform ":vars";
our $VERSION = "0.002";
@@ -25,7 +26,13 @@ sub execstack($) {
my ( $file ) = @_;
my @output;
my @stack;
- execute( [ "readelf", "-l", "-W", $file ], -stdout => \@output );
+ my $tool;
+ if($target_arch eq "mic") {
+ $tool = "x86_64-k1om-linux-readelf";
+ } else {
+ $tool = "readelf";
+ }
+ execute( [ $tool, "-l", "-W", $file ], -stdout => \@output );
@stack = grep( $_ =~ m{\A\s*(?:GNU_)?STACK\s+}, @output );
if ( not @stack ) {
# Interpret missed "STACK" line as error.
@@ -49,6 +56,7 @@ sub execstack($) {
}; # sub execstack
get_options(
+ Platform::target_options(),
);
foreach my $file ( @ARGV ) {
diff --git a/runtime/tools/check-instruction-set.pl b/runtime/tools/check-instruction-set.pl
index 1fa787e..a63d916 100755
--- a/runtime/tools/check-instruction-set.pl
+++ b/runtime/tools/check-instruction-set.pl
@@ -24,48 +24,34 @@ our $VERSION = "0.004";
my $hex = qr{[0-9a-f]}i; # hex digit.
-# lrb_32e-specific details.
+# mic-specific details.
-my $mic_arch; # either knf or knc
-my $mic_os; # either bsd or lin
-sub bad_lrb_fmt($) {
+sub bad_mic_fmt($) {
# Before we allowed both elf64-x86-64-freebsd and elf-l1om-freebsd.
# Now the first one is obsolete, only elf64-l1om-freebsd is allowed.
my ( $fmt ) = @_;
if ( 0 ) {
- } elsif ( "$mic_os" eq "bsd" ) {
- if ( "$mic_arch" eq "knf" ) {
- return $fmt !~ m{\Aelf64-l1om(?:-freebsd)?\z};
- } else {
- return $fmt !~ m{\Aelf64-x86-64(?:-freebsd)?\z};
- };
- } elsif ( "$mic_os" eq "lin" ) {
- if ( 0 ) {
- } elsif ( "$mic_arch" eq "knf" ) {
+ } elsif ( "$target_mic_arch" eq "knf" ) {
return $fmt !~ m{\Aelf64-l1om?\z};
- } elsif ( "$mic_arch" eq "knc" ) {
+ } elsif ( "$target_mic_arch" eq "knc" ) {
return $fmt !~ m{\Aelf64-k1om?\z};
} else {
return 1;
};
- } else {
- return 1;
- };
-}; # sub bad_lrb_fmt
+}; # sub bad_mic_fmt
-# Undesired instructions for lrb: all x87 and some other.
+# Undesired instructions for mic: all x87 and some other.
# AC: Since compiler 2010-06-30 x87 instructions are supported, removed the check of x87.
-my $lrb_bad_re;
-sub bad_lrb_instr($$) {
+my $mic_bad_re;
+sub bad_mic_instr($$) {
my ( $instr, $args ) = @_;
-# if ( "$mic_os" eq "lin" and "$mic_arch" eq "knf" ) {
- if ( "$mic_os" eq "lin" or "$mic_arch" eq "knc" ) {
+ if ( "$target_mic_arch" eq "knc" ) {
# workaround of bad code generation on KNF Linux* OS:
- return ( defined( $instr ) and $instr =~ $lrb_bad_re );
+ return ( defined( $instr ) and $instr =~ $mic_bad_re );
} else {
- return ( defined( $instr ) and $instr =~ $lrb_bad_re or defined( $args ) and $args =~ m{xmm}i );
+ return ( defined( $instr ) and $instr =~ $mic_bad_re or defined( $args ) and $args =~ m{xmm}i );
}
-}; # sub bad_lrb_instr
+}; # sub bad_mic_instr
# lin_32-specific details.
@@ -133,11 +119,7 @@ sub check_file($;$$) {
$max_instructions = 100;
}; # if
- if ( "$mic_os" eq "bsd" ) {
- execute( [ "x86_64-freebsd-objdump", "-d", $file ], -stdout => \@bulk );
- } else {
- execute( [ "objdump", "-d", $file ], -stdout => \@bulk );
- }
+ execute( [ "x86_64-k1om-linux-objdump", "-d", $file ], -stdout => \@bulk );
my $n = 0;
my $errors = 0;
@@ -202,24 +184,22 @@ my $show_instructions;
get_options(
"max-instructions=i" => \$max_instructions,
"show-instructions!" => \$show_instructions,
- "mic-arch=s" => \$mic_arch,
- "mic-os=s" => \$mic_os,
Platform::target_options(),
);
-if ( "$mic_os" eq "lin" and "$mic_arch" eq "knf" ) {
- $lrb_bad_re = qr{^(?:pause|[slm]fence|scatter|gather|cmpxchg16b|clevict[12])}i;
+if ( "$target_os" eq "lin" and "$target_mic_arch" eq "knf" ) {
+ $mic_bad_re = qr{^(?:pause|[slm]fence|scatter|gather|cmpxchg16b|clevict[12])}i;
} else {
- $lrb_bad_re = qr{^(?:pause|[slm]fence|scatter|gather|cmov|cmpxchg16b|clevict[12])}i;
+ $mic_bad_re = qr{^(?:pause|[slm]fence|scatter|gather|cmov|cmpxchg16b|clevict[12])}i;
};
if ( 0 ) {
-} elsif ( $target_platform eq "lrb_32e" ) {
- *bad_instr = \*bad_lrb_instr;
- *bad_fmt = \*bad_lrb_fmt;
+} elsif ( $target_os eq "lin" and $target_arch eq "mic" ) {
+ *bad_instr = \*bad_mic_instr;
+ *bad_fmt = \*bad_mic_fmt;
} elsif ( $target_platform eq "lin_32" ) {
*bad_instr = \*bad_ia32_instr;
*bad_fmt = \*bad_ia32_fmt;
} else {
- runtime_error( "Only works on lin_32 and lrb_32e platforms." );
+ runtime_error( "Only works on lin_32 and lin_mic platforms." );
}; # if
# Do the work.
@@ -322,7 +302,7 @@ Currently the script works only for:
=over
-=item C<lrb_32e>
+=item C<lin_mic>
Intel(R) Many Integrated Core Architecture target OS. Undesired unstructions are: all x87 instructions and some others.
diff --git a/runtime/tools/check-tools.pl b/runtime/tools/check-tools.pl
index ae7fb72..5f6e53a 100755
--- a/runtime/tools/check-tools.pl
+++ b/runtime/tools/check-tools.pl
@@ -190,7 +190,7 @@ sub get_intel_compiler_version($) {
if ( not defined( $ic_arch ) ) {
return @ret;
}; # if
- if ( Platform::canon_arch( $ic_arch ) ne $target_arch ) {
+ if ( Platform::canon_arch( $ic_arch ) ne $target_arch and not (Platform::canon_arch($ic_arch) eq "32e" and $target_arch eq "mic" )) {
warning( "Target architecture is $target_arch, $tool for $ic_arch found." );
return @ret;
}; # if
@@ -391,7 +391,6 @@ my $fortran = 0; # Check for corresponding Fortran compiler, ifo
my $clang = 0; # Check Clang Compilers.
my $intel_compilers = {
"lin" => { c => "icc", cpp => "icpc", f => "ifort" },
- "lrb" => { c => "icc", cpp => "icpc", f => "ifort" },
"mac" => { c => "icc", cpp => "icpc", f => "ifort" },
"win" => { c => "icl", cpp => undef, f => "ifort" },
};
diff --git a/runtime/tools/common.inc b/runtime/tools/common.inc
index db13251..e80b68f 100644
--- a/runtime/tools/common.inc
+++ b/runtime/tools/common.inc
@@ -37,12 +37,20 @@ endif # !omp_os
# Compiling for the Intel(R) Many Integrated Core architecture is non-trivial at the next layer
# of script down, but we can make it consistent here.
-ifeq "$(arch)" "mic"
+ifneq "$(filter knf knc knl, $(arch))" ""
# I really do mean this...
- override arch:=32e
+ # have top-level arch=mic and then mic_arch = flavor of mic
+ override mic_arch:=$(arch)
+ override arch:=mic
override mic:=yes
else
- override mic:=no
+ ifeq "$(arch)" "mic"
+ # default flavor of mic is knc
+ mic_arch?=knc
+ override mic:=yes
+ else
+ override mic:=no
+ endif
endif
ifeq (,$(wildcard $(omp_root)/tools/$(omp_os).inc))
@@ -74,15 +82,15 @@ ifneq "$(mic)" "no"
$(error Compiling the runtime with gcc is not supported on Intel\(R\) Many Integrated Core Architecture)
endif
- # Magic flags for the build script!
- build_args += --os=lrb --mic-arch=knc --mic-os=lin --mic-comp=offload
+ # Add Intel(R) Many Integrated Core Architecture kind (knf, knc, knl, etc.)
+ build_args += --mic-arch=$(mic_arch)
# Check that the binutils for Intel(R) Many Integrated Core Architecture are available
# First we see whether the objdump on the user's path supports the k1om architecture.
- hask1om = $(shell if (objdump --help | grep -s k1om); then echo OK; else echo KO; fi)
+ hask1om = $(shell if (x86_64-k1om-linux-objdump --help | grep -s k1om); then echo OK; else echo KO; fi)
ifneq "$(hask1om)" "OK"
# Appropriate binutils are not already set up, so try to add them from the default place.
- micBinPath = /usr/linux-k1om-4.7/x86_64-k1om-linux/bin
+ micBinPath = /usr/linux-k1om-4.7/bin
micBinPresent = $(shell if test -d $(micBinPath); then echo OK; else echo KO; fi)
ifneq "$(micBinPresent)" "OK"
# We can't find them in the normal place, so complain.
diff --git a/runtime/tools/extract-objects.pl b/runtime/tools/extract-objects.pl
index 04be6ea..e9eaa3d 100755
--- a/runtime/tools/extract-objects.pl
+++ b/runtime/tools/extract-objects.pl
@@ -141,7 +141,7 @@ if ( not -w $output ) {
if ( $target_os eq "win" ) {
*process = \&windows;
-} elsif ( $target_os eq "lin" or $target_os eq "lrb" ) {
+} elsif ( $target_os eq "lin") {
*process = \&linux;
} elsif ( $target_os eq "mac" ) {
*process = \&darwin;
diff --git a/runtime/tools/lib/Platform.pm b/runtime/tools/lib/Platform.pm
index 839e54f..2e2b890 100644
--- a/runtime/tools/lib/Platform.pm
+++ b/runtime/tools/lib/Platform.pm
@@ -32,12 +32,12 @@ use Uname;
my @vars;
BEGIN {
- @vars = qw{ $host_arch $host_os $host_platform $target_arch $target_os $target_platform };
+ @vars = qw{ $host_arch $host_os $host_platform $target_arch $target_mic_arch $target_os $target_platform };
}
our $VERSION = "0.014";
our @EXPORT = qw{};
-our @EXPORT_OK = ( qw{ canon_arch canon_os legal_arch arch_opt }, @vars );
+our @EXPORT_OK = ( qw{ canon_arch canon_os canon_mic_arch legal_arch arch_opt }, @vars );
our %EXPORT_TAGS = ( all => [ @EXPORT_OK ], vars => \@vars );
# Canonize architecture name.
@@ -54,6 +54,8 @@ sub canon_arch($) {
$arch = "ppc64";
} elsif ( $arch =~ m{\Aaarch64} ) {
$arch = "aarch64";
+ } elsif ( $arch =~ m{\Amic} ) {
+ $arch = "mic";
} else {
$arch = undef;
}; # if
@@ -61,12 +63,30 @@ sub canon_arch($) {
return $arch;
}; # sub canon_arch
+# Canonize Intel(R) Many Integrated Core Architecture name.
+sub canon_mic_arch($) {
+ my ( $mic_arch ) = @_;
+ if ( defined( $mic_arch ) ) {
+ if ( $mic_arch =~ m{\Aknf} ) {
+ $mic_arch = "knf";
+ } elsif ( $mic_arch =~ m{\Aknc}) {
+ $mic_arch = "knc";
+ } elsif ( $mic_arch =~ m{\Aknl} ) {
+ $mic_arch = "knl";
+ } else {
+ $mic_arch = undef;
+ }; # if
+ }; # if
+ return $mic_arch;
+}; # sub canon_mic_arch
+
{ # Return legal approved architecture name.
my %legal = (
"32" => "IA-32 architecture",
"32e" => "Intel(R) 64",
"arm" => "ARM",
"aarch64" => "AArch64",
+ "mic" => "Intel(R) Many Integrated Core Architecture",
);
sub legal_arch($) {
@@ -86,6 +106,7 @@ sub canon_arch($) {
"64" => "ia64",
"arm" => "arm",
"aarch64" => "aarch",
+ "mic" => "intel64",
);
sub arch_opt($) {
@@ -104,8 +125,6 @@ sub canon_os($) {
if ( defined( $os ) ) {
if ( $os =~ m{\A\s*(?:Linux|lin|l)\s*\z}i ) {
$os = "lin";
- } elsif ( $os =~ m{\A\s*(?:lrb)\s*\z}i ) {
- $os = "lrb";
} elsif ( $os =~ m{\A\s*(?:Mac(?:\s*OS(?:\s*X)?)?|mac|m|Darwin)\s*\z}i ) {
$os = "mac";
} elsif ( $os =~ m{\A\s*(?:Win(?:dows)?(?:(?:_|\s*)?(?:NT|XP|95|98|2003))?|w)\s*\z}i ) {
@@ -117,7 +136,10 @@ sub canon_os($) {
return $os;
}; # sub canon_os
-my ( $_host_os, $_host_arch, $_target_os, $_target_arch );
+my ( $_host_os, $_host_arch, $_target_os, $_target_arch, $_target_mic_arch, $_default_mic_arch);
+
+# Set the default mic-arch value.
+$_default_mic_arch = "knc";
sub set_target_arch($) {
my ( $arch ) = canon_arch( $_[ 0 ] );
@@ -128,6 +150,15 @@ sub set_target_arch($) {
return $arch;
}; # sub set_target_arch
+sub set_target_mic_arch($) {
+ my ( $mic_arch ) = canon_mic_arch( $_[ 0 ] );
+ if ( defined( $mic_arch ) ) {
+ $_target_mic_arch = $mic_arch;
+ $ENV{ LIBOMP_MIC_ARCH } = $mic_arch;
+ }; # if
+ return $mic_arch;
+}; # sub set_target_mic_arch
+
sub set_target_os($) {
my ( $os ) = canon_os( $_[ 0 ] );
if ( defined( $os ) ) {
@@ -149,6 +180,11 @@ sub target_options() {
set_target_arch( $_[ 1 ] ) or
die "Bad value of --target-architecture option: \"$_[ 1 ]\"\n";
},
+ "target-mic-architecture|targert-mic-arch|mic-architecture|mic-arch=s" =>
+ sub {
+ set_target_mic_arch( $_[ 1 ] ) or
+ die "Bad value of --target-mic-architecture option: \"$_[ 1 ]\"\n";
+ },
);
return @options;
}; # sub target_options
@@ -205,6 +241,19 @@ if ( defined( $ENV{ LIBOMP_ARCH } ) ) {
}; # if
$ENV{ LIBOMP_ARCH } = $_target_arch;
+# Detect target Intel(R) Many Integrated Core Architecture.
+if ( defined( $ENV{ LIBOMP_MIC_ARCH } ) ) {
+ # Use mic arch specified in LIBOMP_MIC_ARCH.
+ $_target_mic_arch = canon_mic_arch( $ENV{ LIBOMP_MIC_ARCH } );
+ if ( not defined( $_target_mic_arch ) ) {
+ die "Unknown architecture specified in LIBOMP_MIC_ARCH environment variable: \"$ENV{ LIBOMP_MIC_ARCH }\"";
+ }; # if
+} else {
+ # Otherwise use default Intel(R) Many Integrated Core Architecture.
+ $_target_mic_arch = $_default_mic_arch;
+}; # if
+$ENV{ LIBOMP_MIC_ARCH } = $_target_mic_arch;
+
# Detect target OS.
if ( defined( $ENV{ LIBOMP_OS } ) ) {
# Use OS specified in LIBOMP_OS.
@@ -224,6 +273,7 @@ tie( $host_arch, "Platform::host_arch" );
tie( $host_os, "Platform::host_os" );
tie( $host_platform, "Platform::host_platform" );
tie( $target_arch, "Platform::target_arch" );
+tie( $target_mic_arch, "Platform::target_mic_arch" );
tie( $target_os, "Platform::target_os" );
tie( $target_platform, "Platform::target_platform" );
@@ -269,6 +319,13 @@ tie( $target_platform, "Platform::target_platform" );
}; # sub FETCH
} # package Platform::target_arch
+{ package Platform::target_mic_arch;
+ use base "Platform::base";
+ sub FETCH {
+ return $_target_mic_arch;
+ }; # sub FETCH
+} # package Platform::target_mic_arch
+
{ package Platform::target_os;
use base "Platform::base";
sub FETCH {
@@ -279,7 +336,11 @@ tie( $target_platform, "Platform::target_platform" );
{ package Platform::target_platform;
use base "Platform::base";
sub FETCH {
+ if ($_target_arch eq "mic") {
+ return "${_target_os}_${_target_mic_arch}";
+ } else {
return "${_target_os}_${_target_arch}";
+ }
}; # sub FETCH
} # package Platform::target_platform
@@ -330,7 +391,7 @@ the script assumes host architecture is target one.
Input string is an architecture name to canonize. The function recognizes many variants, for example:
C<32e>, C<Intel64>, C<Intel(R) 64>, etc. Returned string is a canononized architecture name,
-one of: C<32>, C<32e>, C<64>, or C<undef> is input string is not recognized.
+one of: C<32>, C<32e>, C<64>, C<arm>, C<ppc64>, C<mic>, or C<undef> is input string is not recognized.
=item B<legal_arch( $arch )>
@@ -347,7 +408,7 @@ recognized.
=item B<canon_os( $os )>
-Input string is OS name to canonize. The function recognizes many variants, for example: C<mac>, C<OS X>, etc. Returned string is a canonized OS name, one of: C<lin>, C<lrb>,
+Input string is OS name to canonize. The function recognizes many variants, for example: C<mac>, C<OS X>, etc. Returned string is a canonized OS name, one of: C<lin>,
C<mac>, C<win>, or C<undef> is input string is not recognized.
=item B<target_options()>
diff --git a/runtime/tools/message-converter.pl b/runtime/tools/message-converter.pl
index 382f42e..f4f4b99 100755
--- a/runtime/tools/message-converter.pl
+++ b/runtime/tools/message-converter.pl
@@ -485,7 +485,7 @@ $input_file = $ARGV[ 0 ];
my $generate_message;
-if ( $target_os =~ m{\A(?:lin|lrb|mac)\z} ) {
+if ( $target_os =~ m{\A(?:lin|mac)\z} ) {
$generate_message = \&generate_message_unix;
} elsif ( $target_os eq "win" ) {
$generate_message = \&generate_message_windows;
diff --git a/runtime/tools/required-objects.pl b/runtime/tools/required-objects.pl
index b378b08..5d2b6a0 100755
--- a/runtime/tools/required-objects.pl
+++ b/runtime/tools/required-objects.pl
@@ -117,9 +117,15 @@ sub _load_symbols_nm($) {
if ( %$objects ) {
# Do not run nm if a set of objects is empty -- nm will try to open a.out in this case.
+ my $tool;
+ if($target_arch eq "mic") {
+ $tool = "x86_64-k1om-linux-nm"
+ } else {
+ $tool = "nm"
+ }
execute(
[
- "nm",
+ $tool,
"-g", # Display only external (global) symbols.
"-o", # Precede each symbol by the name of the input file.
keys( %$objects )
@@ -397,10 +403,17 @@ sub copy_objects($$;$\@) {
my $target = shift( @_ );
my $prefix = shift( @_ );
my $symbols = shift( @_ );
+ my $tool;
my @redefine;
my @redefine_;
my $syms_file = "__kmp_sym_pairs.log";
+ if ( $target_arch eq "mic" ) {
+ $tool = "x86_64-k1om-linux-objcopy"
+ } else {
+ $tool = "objcopy"
+ }
+
if ( not -e $target ) {
die "\"$target\" directory does not exist\n";
}; # if
@@ -420,7 +433,7 @@ sub copy_objects($$;$\@) {
foreach my $src ( sort( keys( %$objects ) ) ) {
my $dst = cat_file( $target, get_file( $src ) );
if ( @redefine ) {
- execute( [ "objcopy", "--redefine-syms", $syms_file, $src, $dst ] );
+ execute( [ $tool, "--redefine-syms", $syms_file, $src, $dst ] );
} else {
copy_file( $src, $dst, -overwrite => 1 );
}; # if
@@ -482,7 +495,7 @@ if ( not %$base ) {
if ( $target_os eq "win" ) {
*load_symbols = \&_load_symbols_link;
-} elsif ( $target_os eq "lin" or $target_os eq "lrb" ) {
+} elsif ( $target_os eq "lin" ) {
*load_symbols = \&_load_symbols_nm;
} elsif ( $target_os eq "mac" ) {
*load_symbols = \&_load_symbols_nm;
diff --git a/runtime/tools/src/common-defs.mk b/runtime/tools/src/common-defs.mk
index 252a962..82a6b54 100644
--- a/runtime/tools/src/common-defs.mk
+++ b/runtime/tools/src/common-defs.mk
@@ -45,7 +45,7 @@ endif
# Description:
# The function return printable name of specified architecture, IA-32 architecture or Intel(R) 64.
#
-legal_arch = $(if $(filter 32,$(1)),IA-32,$(if $(filter 32e,$(1)),Intel(R) 64,$(if $(filter l1,$(1)),L1OM,$(if $(filter arm,$(1)),ARM,$(if $(filter ppc64,$(1)),PPC64,$(if $(filter aarch64,$(1)),AArch64,$(error Bad architecture specified: $(1))))))))
+legal_arch = $(if $(filter 32,$(1)),IA-32,$(if $(filter 32e,$(1)),Intel(R) 64,$(if $(filter l1,$(1)),L1OM,$(if $(filter arm,$(1)),ARM,$(if $(filter ppc64,$(1)),PPC64,$(if $(filter aarch64,$(1)),AArch64,$(if $(filter mic,$(1)),Intel(R) Many Integrated Core Architecture,$(error Bad architecture specified: $(1)))))))))
# Synopsis:
# var_name = $(call check_variable,var,list)
@@ -127,10 +127,14 @@ endif
# Mandatory variables passed from build.pl.
# --------------------------------------------------------------------------------------------------
-os := $(call check_variable,os,lin lrb mac win)
-arch := $(call check_variable,arch,32 32e 64 arm ppc64 aarch64)
-platform := $(os)_$(arch)
-platform := $(call check_variable,platform,lin_32 lin_32e lin_64 lin_arm lrb_32e mac_32 mac_32e win_32 win_32e win_64 lin_ppc64 lin_aarch64)
+os := $(call check_variable,os,lin mac win)
+arch := $(call check_variable,arch,32 32e 64 arm ppc64 aarch64 mic)
+ifeq "$(arch)" "mic" # We want the flavor of mic (knf, knc, knl, etc.)
+ platform := $(os)_$(MIC_ARCH)
+else
+ platform := $(os)_$(arch)
+endif
+platform := $(call check_variable,platform,lin_32 lin_32e lin_64 lin_arm lin_knc lin_knf mac_32 mac_32e win_32 win_32e win_64 lin_ppc64 lin_aarch64)
# oa-opts means "os and arch options". They are passed to almost all perl scripts.
oa-opts := --os=$(os) --arch=$(arch)
@@ -155,7 +159,7 @@ ifeq "$(os)" "win" # win
dll = .dll
exe = .exe
cat = $(dll)
-else # lin, lrb or mac
+else # lin, mic or mac
asm = .s
obj = .o
lib = .a
@@ -180,7 +184,7 @@ ifeq "$(os)" "win"
touch = touch
perl = perl
slash = \\
-else # lin, lrb or mac
+else # lin, mic or mac
cp = cp -f
rm = rm -f
mkdir = mkdir -p
diff --git a/runtime/tools/src/common-rules.mk b/runtime/tools/src/common-rules.mk
index c289beb..a63aa0b 100644
--- a/runtime/tools/src/common-rules.mk
+++ b/runtime/tools/src/common-rules.mk
@@ -79,9 +79,9 @@
%$(obj) : %$(asm) .rebuild
$(target)
- # There is a bug on lrb: icc does not work with "-x assembler-with-cpp" option, so we have
+ # There is a bug on mic: icc does not work with "-x assembler-with-cpp" option, so we have
# to preprocess file manually and then assembly it.
- ifeq "$(os)" "lrb"
+ ifeq "$(arch)" "mic"
$(c) -E $(cpp-flags) $< > $@.tmp
$(as) $(as-flags) -x assembler $(as-out)$@ $@.tmp
else
@@ -130,9 +130,13 @@ expand-vars = $(perl) $(tools_dir)expand-vars.pl --strict $(ev-flags) $< $@
# strip debug info in case it is requested (works for Linux* OS only)
ifneq "$(dbg_strip)" ""
ifeq "$(DEBUG_INFO)" "off"
+ ifeq "$(arch)" "mic"
+ x86_64-k1om-linux-objcopy --strip-debug $@
+ else
objcopy --strip-debug $@
endif
endif
+ endif
# -- Making dynamic library ---
@@ -156,7 +160,11 @@ expand-vars = $(perl) $(tools_dir)expand-vars.pl --strict $(ev-flags) $< $@
%.dbg : %$(dll) .rebuild
$(target)
+ ifeq "$(arch)" "mic"
+ x86_64-k1om-linux-objcopy --only-keep-debug $< $@
+ else
objcopy --only-keep-debug $< $@
+ endif
.PRECIOUS: %.res # Do not delete automatically created files.
diff --git a/runtime/tools/src/common-tools.mk b/runtime/tools/src/common-tools.mk
index 873ee88..5c9dcb7 100644
--- a/runtime/tools/src/common-tools.mk
+++ b/runtime/tools/src/common-tools.mk
@@ -34,7 +34,7 @@
# "No rule to build .\kmp_i18n.inc". Using "./" solves the problem.
cpp-flags += -I ./
# For non-x86 architecture
-ifeq "$(filter 32 32e 64,$(arch))" ""
+ifeq "$(filter 32 32e 64 mic,$(arch))" ""
cpp-flags += $(shell pkg-config --cflags libffi)
endif
# Add all VPATH directories to path for searching include files.
@@ -57,7 +57,7 @@ endif
# --- Linux* OS, Intel(R) Many Integrated Core Architecture and OS X* definitions ---
-ifneq "$(filter lin lrb mac,$(os))" ""
+ifneq "$(filter lin mac,$(os))" ""
# --- C/C++ ---
ifeq "$(c)" ""
c = icc
@@ -160,6 +160,7 @@ endif
# --- Linux* OS definitions ---
ifeq "$(os)" "lin"
+ifneq "$(arch)" "mic"
# --- C/C++ ---
# On lin_32, we want to maintain stack alignment to be conpatible with GNU binaries built with
# compiler.
@@ -212,15 +213,16 @@ ifeq "$(os)" "lin"
ld-flags-dll += -Wl,-soname=$(@F)
endif
endif
+endif
# --- Intel(R) Many Integrated Core Architecture definitions ---
-ifeq "$(os)" "lrb"
+ifeq "$(arch)" "mic"
# --- C/C++ ---
# Intel(R) Many Integrated Core Architecture specific options, need clarification for purpose:
#c-flags += -mmic -mP2OPT_intrin_disable_name=memcpy -mP2OPT_intrin_disable_name=memset -mGLOB_freestanding -mGLOB_nonstandard_lib -nostdlib -fno-builtin
#cxx-flags += -mmic -mP2OPT_intrin_disable_name=memcpy -mP2OPT_intrin_disable_name=memset -mGLOB_freestanding -mGLOB_nonstandard_lib -nostdlib -fno-builtin
- # icc for lrb has a bug: it generates dependencies for target like file.obj, while real object
+ # icc for mic has a bug: it generates dependencies for target like file.obj, while real object
# files are named file.o. -MT is a workaround for the problem.
c-flags-m += -MT $(basename $@).o
cxx-flags-m += -MT $(basename $@).o