diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2022-10-17 22:19:55 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2022-11-04 10:51:01 +0100 |
commit | e4cba49413ca429dc82f6aa2e88129ecb3fdd943 (patch) | |
tree | c949e231f1a973cb7cb5aad1985c2aab9c653378 /gcc | |
parent | e724b0480bfa5ec04f39be8c7290330b495c59de (diff) | |
download | gcc-e4cba49413ca429dc82f6aa2e88129ecb3fdd943.zip gcc-e4cba49413ca429dc82f6aa2e88129ecb3fdd943.tar.gz gcc-e4cba49413ca429dc82f6aa2e88129ecb3fdd943.tar.bz2 |
Remove support for Intel MIC offloading
... after its deprecation in GCC 12.
* Makefile.def: Remove module 'liboffloadmic'.
* Makefile.in: Regenerate.
* configure.ac: Remove 'liboffloadmic' handling.
* configure: Regenerate.
contrib/
* gcc-changelog/git_commit.py (default_changelog_locations):
Remove 'liboffloadmic'.
* gcc_update (files_and_dependencies): Remove 'liboffloadmic'
files.
* update-copyright.py (GCCCmdLine): Remove 'liboffloadmic'
comment.
gcc/
* config.gcc [target *-intelmic-* | *-intelmicemul-*]: Remove.
* config/i386/i386-options.cc (ix86_omp_device_kind_arch_isa)
[ACCEL_COMPILER]: Remove.
* config/i386/intelmic-mkoffload.cc: Remove.
* config/i386/intelmic-offload.h: Likewise.
* config/i386/t-intelmic: Likewise.
* config/i386/t-omp-device: Likewise.
* configure.ac [target *-intelmic-* | *-intelmicemul-*]: Remove.
* configure: Regenerate.
* doc/install.texi (--enable-offload-targets=[...]): Update.
* doc/sourcebuild.texi: Remove 'liboffloadmic' documentation.
include/
* gomp-constants.h (GOMP_DEVICE_INTEL_MIC): Comment out.
(GOMP_VERSION_INTEL_MIC): Remove.
libgomp/
* libgomp-plugin.h (OFFLOAD_TARGET_TYPE_INTEL_MIC): Remove.
* libgomp.texi (OpenMP Context Selectors): Remove Intel MIC
documentation.
* plugin/configfrag.ac <enable_offload_targets>
[*-intelmic-* | *-intelmicemul-*]: Remove.
* configure: Regenerate.
* testsuite/lib/libgomp.exp (libgomp_init): Remove 'liboffloadmic'
handling.
(offload_target_to_openacc_device_type)
[$offload_target = *-intelmic*]: Remove.
(check_effective_target_offload_device_intel_mic)
(check_effective_target_offload_device_any_intel_mic): Remove.
* testsuite/libgomp.c-c++-common/on_device_arch.h
(device_arch_intel_mic, on_device_arch_intel_mic, any_device_arch)
(any_device_arch_intel_mic): Remove.
* testsuite/libgomp.c-c++-common/target-45.c: Remove
'offload_device_any_intel_mic' XFAIL.
* testsuite/libgomp.fortran/target10.f90: Likewise.
liboffloadmic/
* ChangeLog: Remove.
* Makefile.am: Likewise.
* Makefile.in: Likewise.
* aclocal.m4: Likewise.
* configure: Likewise.
* configure.ac: Likewise.
* configure.tgt: Likewise.
* doc/doxygen/config: Likewise.
* doc/doxygen/header.tex: Likewise.
* include/coi/common/COIEngine_common.h: Likewise.
* include/coi/common/COIEvent_common.h: Likewise.
* include/coi/common/COIMacros_common.h: Likewise.
* include/coi/common/COIPerf_common.h: Likewise.
* include/coi/common/COIResult_common.h: Likewise.
* include/coi/common/COISysInfo_common.h: Likewise.
* include/coi/common/COITypes_common.h: Likewise.
* include/coi/sink/COIBuffer_sink.h: Likewise.
* include/coi/sink/COIPipeline_sink.h: Likewise.
* include/coi/sink/COIProcess_sink.h: Likewise.
* include/coi/source/COIBuffer_source.h: Likewise.
* include/coi/source/COIEngine_source.h: Likewise.
* include/coi/source/COIEvent_source.h: Likewise.
* include/coi/source/COIPipeline_source.h: Likewise.
* include/coi/source/COIProcess_source.h: Likewise.
* liboffloadmic_host.spec.in: Likewise.
* liboffloadmic_target.spec.in: Likewise.
* plugin/Makefile.am: Likewise.
* plugin/Makefile.in: Likewise.
* plugin/aclocal.m4: Likewise.
* plugin/configure: Likewise.
* plugin/configure.ac: Likewise.
* plugin/libgomp-plugin-intelmic.cpp: Likewise.
* plugin/offload_target_main.cpp: Likewise.
* runtime/cean_util.cpp: Likewise.
* runtime/cean_util.h: Likewise.
* runtime/coi/coi_client.cpp: Likewise.
* runtime/coi/coi_client.h: Likewise.
* runtime/coi/coi_server.cpp: Likewise.
* runtime/coi/coi_server.h: Likewise.
* runtime/compiler_if_host.cpp: Likewise.
* runtime/compiler_if_host.h: Likewise.
* runtime/compiler_if_target.cpp: Likewise.
* runtime/compiler_if_target.h: Likewise.
* runtime/dv_util.cpp: Likewise.
* runtime/dv_util.h: Likewise.
* runtime/emulator/coi_common.h: Likewise.
* runtime/emulator/coi_device.cpp: Likewise.
* runtime/emulator/coi_device.h: Likewise.
* runtime/emulator/coi_host.cpp: Likewise.
* runtime/emulator/coi_host.h: Likewise.
* runtime/emulator/coi_version_asm.h: Likewise.
* runtime/emulator/coi_version_linker_script.map: Likewise.
* runtime/liboffload_error.c: Likewise.
* runtime/liboffload_error_codes.h: Likewise.
* runtime/liboffload_msg.c: Likewise.
* runtime/liboffload_msg.h: Likewise.
* runtime/mic_lib.f90: Likewise.
* runtime/offload.h: Likewise.
* runtime/offload_common.cpp: Likewise.
* runtime/offload_common.h: Likewise.
* runtime/offload_engine.cpp: Likewise.
* runtime/offload_engine.h: Likewise.
* runtime/offload_env.cpp: Likewise.
* runtime/offload_env.h: Likewise.
* runtime/offload_host.cpp: Likewise.
* runtime/offload_host.h: Likewise.
* runtime/offload_iterator.h: Likewise.
* runtime/offload_omp_host.cpp: Likewise.
* runtime/offload_omp_target.cpp: Likewise.
* runtime/offload_orsl.cpp: Likewise.
* runtime/offload_orsl.h: Likewise.
* runtime/offload_table.cpp: Likewise.
* runtime/offload_table.h: Likewise.
* runtime/offload_target.cpp: Likewise.
* runtime/offload_target.h: Likewise.
* runtime/offload_target_main.cpp: Likewise.
* runtime/offload_timer.h: Likewise.
* runtime/offload_timer_host.cpp: Likewise.
* runtime/offload_timer_target.cpp: Likewise.
* runtime/offload_trace.cpp: Likewise.
* runtime/offload_trace.h: Likewise.
* runtime/offload_util.cpp: Likewise.
* runtime/offload_util.h: Likewise.
* runtime/ofldbegin.cpp: Likewise.
* runtime/ofldend.cpp: Likewise.
* runtime/orsl-lite/include/orsl-lite.h: Likewise.
* runtime/orsl-lite/lib/orsl-lite.c: Likewise.
* runtime/orsl-lite/version.txt: Likewise.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config.gcc | 8 | ||||
-rw-r--r-- | gcc/config/i386/i386-options.cc | 4 | ||||
-rw-r--r-- | gcc/config/i386/intelmic-mkoffload.cc | 728 | ||||
-rw-r--r-- | gcc/config/i386/intelmic-offload.h | 35 | ||||
-rw-r--r-- | gcc/config/i386/t-intelmic | 10 | ||||
-rw-r--r-- | gcc/config/i386/t-omp-device | 6 | ||||
-rwxr-xr-x | gcc/configure | 14 | ||||
-rw-r--r-- | gcc/configure.ac | 10 | ||||
-rw-r--r-- | gcc/doc/install.texi | 2 | ||||
-rw-r--r-- | gcc/doc/sourcebuild.texi | 3 |
10 files changed, 3 insertions, 817 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc index 1191a0d..f41c095 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -3552,14 +3552,6 @@ case ${target} in ;; esac -# Build mkoffload tool -case ${target} in -*-intelmic-* | *-intelmicemul-*) - tmake_file="${tmake_file} i386/t-intelmic" - tm_file="${tm_file} i386/intelmic-offload.h" - ;; -esac - if [ "$target_has_targetcm" = "no" ]; then c_target_objs="$c_target_objs default-c.o" cxx_target_objs="$cxx_target_objs default-c.o" diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index bbb8307..2c16dc0 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -314,10 +314,6 @@ ix86_omp_device_kind_arch_isa (enum omp_device_kind_arch_isa trait, case omp_device_kind: return strcmp (name, "cpu") == 0; case omp_device_arch: -#ifdef ACCEL_COMPILER - if (strcmp (name, "intel_mic") == 0) - return 1; -#endif if (strcmp (name, "x86") == 0) return 1; if (TARGET_64BIT) diff --git a/gcc/config/i386/intelmic-mkoffload.cc b/gcc/config/i386/intelmic-mkoffload.cc deleted file mode 100644 index 5deddff..0000000 --- a/gcc/config/i386/intelmic-mkoffload.cc +++ /dev/null @@ -1,728 +0,0 @@ -/* Offload image generation tool for Intel MIC devices. - - Copyright (C) 2014-2022 Free Software Foundation, Inc. - - Contributed by Ilya Verbin <ilya.verbin@intel.com>. - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - GCC is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING3. If not see - <http://www.gnu.org/licenses/>. */ - -#define IN_TARGET_CODE 1 - -#include "config.h" -#include <libgen.h> -#include "system.h" -#include "coretypes.h" -#include "obstack.h" -#include "intl.h" -#include "diagnostic.h" -#include "collect-utils.h" -#include "intelmic-offload.h" - -const char tool_name[] = "intelmic mkoffload"; - -const char image_section_name[] = ".gnu.offload_images"; -const char *symbols[3] = { "__offload_image_intelmic_start", - "__offload_image_intelmic_end", - "__offload_image_intelmic_size" }; -const char *out_obj_filename = NULL; - -int num_temps = 0; -const int MAX_NUM_TEMPS = 10; -const char *temp_files[MAX_NUM_TEMPS]; - -enum offload_abi offload_abi = OFFLOAD_ABI_UNSET; - -/* Delete tempfiles and exit function. */ - -void -tool_cleanup (bool from_signal ATTRIBUTE_UNUSED) -{ - for (int i = 0; i < num_temps; i++) - maybe_unlink (temp_files[i]); -} - -static void -mkoffload_cleanup (void) -{ - tool_cleanup (false); -} - -/* Unlink FILE unless requested otherwise. */ - -void -maybe_unlink (const char *file) -{ - if (!save_temps) - { - if (unlink_if_ordinary (file) - && errno != ENOENT) - fatal_error (input_location, "deleting file %s: %m", file); - } - else if (verbose) - fprintf (stderr, "[Leaving %s]\n", file); -} - -/* Add or change the value of an environment variable, outputting the - change to standard error if in verbose mode. */ -static void -xputenv (const char *string) -{ - if (verbose) - fprintf (stderr, "%s\n", string); - putenv (CONST_CAST (char *, string)); -} - -/* Parse STR, saving found tokens into PVALUES and return their number. - Tokens are assumed to be delimited by ':'. */ -static unsigned -parse_env_var (const char *str, char ***pvalues) -{ - const char *curval, *nextval; - char **values; - unsigned num = 1, i; - - curval = strchr (str, ':'); - while (curval) - { - num++; - curval = strchr (curval + 1, ':'); - } - - values = (char **) xmalloc (num * sizeof (char *)); - curval = str; - nextval = strchr (curval, ':'); - if (nextval == NULL) - nextval = strchr (curval, '\0'); - - for (i = 0; i < num; i++) - { - int l = nextval - curval; - values[i] = (char *) xmalloc (l + 1); - memcpy (values[i], curval, l); - values[i][l] = 0; - curval = nextval + 1; - nextval = strchr (curval, ':'); - if (nextval == NULL) - nextval = strchr (curval, '\0'); - } - *pvalues = values; - return num; -} - -/* Auxiliary function that frees elements of PTR and PTR itself. - N is number of elements to be freed. If PTR is NULL, nothing is freed. - If an element is NULL, subsequent elements are not freed. */ -static void -free_array_of_ptrs (void **ptr, unsigned n) -{ - unsigned i; - if (!ptr) - return; - for (i = 0; i < n; i++) - { - if (!ptr[i]) - break; - free (ptr[i]); - } - free (ptr); - return; -} - -/* Check whether NAME can be accessed in MODE. This is like access, - except that it never considers directories to be executable. */ -static int -access_check (const char *name, int mode) -{ - if (mode == X_OK) - { - struct stat st; - - if (stat (name, &st) < 0 || S_ISDIR (st.st_mode)) - return -1; - } - - return access (name, mode); -} - -/* Find target compiler using a path from COLLECT_GCC or COMPILER_PATH. */ -static char * -find_target_compiler (const char *name) -{ - bool found = false; - char **paths = NULL; - unsigned n_paths, i; - char *target_compiler; - const char *collect_gcc = getenv ("COLLECT_GCC"); - const char *gcc_path = dirname (ASTRDUP (collect_gcc)); - const char *gcc_exec = basename (ASTRDUP (collect_gcc)); - - if (strcmp (gcc_exec, collect_gcc) == 0) - { - /* collect_gcc has no path, so it was found in PATH. Make sure we also - find accel-gcc in PATH. */ - target_compiler = XDUPVEC (char, name, strlen (name) + 1); - found = true; - goto out; - } - - target_compiler = concat (gcc_path, "/", name, NULL); - if (access_check (target_compiler, X_OK) == 0) - { - found = true; - goto out; - } - - n_paths = parse_env_var (getenv ("COMPILER_PATH"), &paths); - for (i = 0; i < n_paths; i++) - { - size_t len = strlen (paths[i]) + 1 + strlen (name) + 1; - target_compiler = XRESIZEVEC (char, target_compiler, len); - sprintf (target_compiler, "%s/%s", paths[i], name); - if (access_check (target_compiler, X_OK) == 0) - { - found = true; - break; - } - } - -out: - free_array_of_ptrs ((void **) paths, n_paths); - return found ? target_compiler : NULL; -} - -static void -compile_for_target (struct obstack *argv_obstack) -{ - switch (offload_abi) - { - case OFFLOAD_ABI_LP64: - obstack_ptr_grow (argv_obstack, "-m64"); - break; - case OFFLOAD_ABI_ILP32: - obstack_ptr_grow (argv_obstack, "-m32"); - break; - default: - gcc_unreachable (); - } - obstack_ptr_grow (argv_obstack, NULL); - char **argv = XOBFINISH (argv_obstack, char **); - - /* Save environment variables. */ - const char *epath = getenv ("GCC_EXEC_PREFIX"); - const char *cpath = getenv ("COMPILER_PATH"); - const char *lpath = getenv ("LIBRARY_PATH"); - const char *rpath = getenv ("LD_RUN_PATH"); - unsetenv ("GCC_EXEC_PREFIX"); - unsetenv ("COMPILER_PATH"); - unsetenv ("LIBRARY_PATH"); - unsetenv ("LD_RUN_PATH"); - - fork_execute (argv[0], argv, false, NULL); - obstack_free (argv_obstack, NULL); - - /* Restore environment variables. */ - xputenv (concat ("GCC_EXEC_PREFIX=", epath, NULL)); - xputenv (concat ("COMPILER_PATH=", cpath, NULL)); - xputenv (concat ("LIBRARY_PATH=", lpath, NULL)); - xputenv (concat ("LD_RUN_PATH=", rpath, NULL)); -} - -/* Generates object file with the descriptor for the target library. */ -static const char * -generate_target_descr_file (const char *target_compiler) -{ - char *dump_filename = concat (dumppfx, "_target_descr.c", NULL); - const char *src_filename = save_temps - ? dump_filename - : make_temp_file ("_target_descr.c"); - const char *obj_filename = save_temps - ? concat (dumppfx, "_target_descr.o", NULL) - : make_temp_file ("_target_descr.o"); - temp_files[num_temps++] = src_filename; - temp_files[num_temps++] = obj_filename; - FILE *src_file = fopen (src_filename, "w"); - - if (!src_file) - fatal_error (input_location, "cannot open '%s'", src_filename); - - fprintf (src_file, - "extern const void *const __offload_funcs_end[];\n" - "extern const void *const __offload_vars_end[];\n\n" - - "const void *const __offload_func_table[0]\n" - "__attribute__ ((__used__, visibility (\"hidden\"),\n" - "section (\".gnu.offload_funcs\"))) = { };\n\n" - - "const void *const __offload_var_table[0]\n" - "__attribute__ ((__used__, visibility (\"hidden\"),\n" - "section (\".gnu.offload_vars\"))) = { };\n\n" - - "const void *const __OFFLOAD_TARGET_TABLE__[]\n" - "__attribute__ ((__used__, visibility (\"hidden\"))) = {\n" - " &__offload_func_table, &__offload_funcs_end,\n" - " &__offload_var_table, &__offload_vars_end\n" - "};\n\n"); - - fprintf (src_file, - "#ifdef __cplusplus\n" - "extern \"C\"\n" - "#endif\n" - "void target_register_lib (const void *);\n\n" - - "__attribute__((constructor))\n" - "static void\n" - "init (void)\n" - "{\n" - " target_register_lib (__OFFLOAD_TARGET_TABLE__);\n" - "}\n"); - fclose (src_file); - - struct obstack argv_obstack; - obstack_init (&argv_obstack); - obstack_ptr_grow (&argv_obstack, target_compiler); - if (save_temps) - obstack_ptr_grow (&argv_obstack, "-save-temps"); - if (verbose) - obstack_ptr_grow (&argv_obstack, "-v"); - obstack_ptr_grow (&argv_obstack, "-dumpdir"); - obstack_ptr_grow (&argv_obstack, ""); - obstack_ptr_grow (&argv_obstack, "-dumpbase"); - obstack_ptr_grow (&argv_obstack, dump_filename); - obstack_ptr_grow (&argv_obstack, "-dumpbase-ext"); - obstack_ptr_grow (&argv_obstack, ".c"); - obstack_ptr_grow (&argv_obstack, "-c"); - obstack_ptr_grow (&argv_obstack, "-shared"); - obstack_ptr_grow (&argv_obstack, "-fPIC"); - obstack_ptr_grow (&argv_obstack, src_filename); - obstack_ptr_grow (&argv_obstack, "-o"); - obstack_ptr_grow (&argv_obstack, obj_filename); - compile_for_target (&argv_obstack); - - return obj_filename; -} - -/* Generates object file with __offload_*_end symbols for the target - library. */ -static const char * -generate_target_offloadend_file (const char *target_compiler) -{ - char *dump_filename = concat (dumppfx, "_target_offloadend.c", NULL); - const char *src_filename = save_temps - ? dump_filename - : make_temp_file ("_target_offloadend.c"); - const char *obj_filename = save_temps - ? concat (dumppfx, "_target_offloadend.o", NULL) - : make_temp_file ("_target_offloadend.o"); - temp_files[num_temps++] = src_filename; - temp_files[num_temps++] = obj_filename; - FILE *src_file = fopen (src_filename, "w"); - - if (!src_file) - fatal_error (input_location, "cannot open '%s'", src_filename); - - fprintf (src_file, - "const void *const __offload_funcs_end[0]\n" - "__attribute__ ((__used__, visibility (\"hidden\"),\n" - "section (\".gnu.offload_funcs\"))) = { };\n\n" - - "const void *const __offload_vars_end[0]\n" - "__attribute__ ((__used__, visibility (\"hidden\"),\n" - "section (\".gnu.offload_vars\"))) = { };\n"); - fclose (src_file); - - struct obstack argv_obstack; - obstack_init (&argv_obstack); - obstack_ptr_grow (&argv_obstack, target_compiler); - if (save_temps) - obstack_ptr_grow (&argv_obstack, "-save-temps"); - if (verbose) - obstack_ptr_grow (&argv_obstack, "-v"); - obstack_ptr_grow (&argv_obstack, "-dumpdir"); - obstack_ptr_grow (&argv_obstack, ""); - obstack_ptr_grow (&argv_obstack, "-dumpbase"); - obstack_ptr_grow (&argv_obstack, dump_filename); - obstack_ptr_grow (&argv_obstack, "-dumpbase-ext"); - obstack_ptr_grow (&argv_obstack, ".c"); - obstack_ptr_grow (&argv_obstack, "-c"); - obstack_ptr_grow (&argv_obstack, "-shared"); - obstack_ptr_grow (&argv_obstack, "-fPIC"); - obstack_ptr_grow (&argv_obstack, src_filename); - obstack_ptr_grow (&argv_obstack, "-o"); - obstack_ptr_grow (&argv_obstack, obj_filename); - compile_for_target (&argv_obstack); - - return obj_filename; -} - -/* Generates object file with the host side descriptor. */ -static const char * -generate_host_descr_file (const char *host_compiler, uint32_t omp_requires) -{ - char *dump_filename = concat (dumppfx, "_host_descr.c", NULL); - const char *src_filename = save_temps - ? dump_filename - : make_temp_file ("_host_descr.c"); - const char *obj_filename = save_temps - ? concat (dumppfx, "_host_descr.o", NULL) - : make_temp_file ("_host_descr.o"); - temp_files[num_temps++] = src_filename; - temp_files[num_temps++] = obj_filename; - FILE *src_file = fopen (src_filename, "w"); - - if (!src_file) - fatal_error (input_location, "cannot open '%s'", src_filename); - - fprintf (src_file, "#include <stdint.h>\n\n"); - - fprintf (src_file, - "extern const void *const __OFFLOAD_TABLE__;\n" - "extern const void *const __offload_image_intelmic_start;\n" - "extern const void *const __offload_image_intelmic_end;\n\n" - - "static const struct intelmic_data {\n" - " uintptr_t omp_requires_mask;\n" - " const void *const image_start;\n" - " const void *const image_end;\n" - "} intelmic_data = {\n" - " %d,\n" - " &__offload_image_intelmic_start, &__offload_image_intelmic_end\n" - "};\n\n", omp_requires); - - fprintf (src_file, - "#ifdef __cplusplus\n" - "extern \"C\"\n" - "#endif\n" - "void GOMP_offload_register_ver (unsigned, const void *, int, const void *);\n" - "#ifdef __cplusplus\n" - "extern \"C\"\n" - "#endif\n" - "void GOMP_offload_unregister_ver (unsigned, const void *, int, const void *);\n\n" - - "__attribute__((constructor))\n" - "static void\n" - "init (void)\n" - "{\n" - " GOMP_offload_register_ver (%#x, &__OFFLOAD_TABLE__, %d, &intelmic_data);\n" - "}\n\n", - GOMP_VERSION_PACK (GOMP_VERSION, GOMP_VERSION_INTEL_MIC), - GOMP_DEVICE_INTEL_MIC); - - fprintf (src_file, - "__attribute__((destructor))\n" - "static void\n" - "fini (void)\n" - "{\n" - " GOMP_offload_unregister_ver (%#x, &__OFFLOAD_TABLE__, %d, &intelmic_data);\n" - "}\n", - GOMP_VERSION_PACK (GOMP_VERSION, GOMP_VERSION_INTEL_MIC), - GOMP_DEVICE_INTEL_MIC); - - fclose (src_file); - - struct obstack argv_obstack; - obstack_init (&argv_obstack); - obstack_ptr_grow (&argv_obstack, host_compiler); - if (save_temps) - obstack_ptr_grow (&argv_obstack, "-save-temps"); - if (verbose) - obstack_ptr_grow (&argv_obstack, "-v"); - obstack_ptr_grow (&argv_obstack, "-dumpdir"); - obstack_ptr_grow (&argv_obstack, ""); - obstack_ptr_grow (&argv_obstack, "-dumpbase"); - obstack_ptr_grow (&argv_obstack, dump_filename); - obstack_ptr_grow (&argv_obstack, "-dumpbase-ext"); - obstack_ptr_grow (&argv_obstack, ".c"); - obstack_ptr_grow (&argv_obstack, "-c"); - obstack_ptr_grow (&argv_obstack, "-fPIC"); - obstack_ptr_grow (&argv_obstack, "-shared"); - switch (offload_abi) - { - case OFFLOAD_ABI_LP64: - obstack_ptr_grow (&argv_obstack, "-m64"); - break; - case OFFLOAD_ABI_ILP32: - obstack_ptr_grow (&argv_obstack, "-m32"); - break; - default: - gcc_unreachable (); - } - obstack_ptr_grow (&argv_obstack, src_filename); - obstack_ptr_grow (&argv_obstack, "-o"); - obstack_ptr_grow (&argv_obstack, obj_filename); - obstack_ptr_grow (&argv_obstack, NULL); - - char **argv = XOBFINISH (&argv_obstack, char **); - fork_execute (argv[0], argv, false, NULL); - obstack_free (&argv_obstack, NULL); - - return obj_filename; -} - -static const char * -prepare_target_image (const char *target_compiler, int argc, char **argv, uint32_t *omp_requires) -{ - const char *target_descr_filename - = generate_target_descr_file (target_compiler); - const char *target_offloadend_filename - = generate_target_offloadend_file (target_compiler); - - char *opt1 - = XALLOCAVEC (char, sizeof ("-Wl,") + strlen (target_descr_filename)); - char *opt2 - = XALLOCAVEC (char, sizeof ("-Wl,") + strlen (target_offloadend_filename)); - sprintf (opt1, "-Wl,%s", target_descr_filename); - sprintf (opt2, "-Wl,%s", target_offloadend_filename); - - char *dump_filename = concat (dumppfx, ".mkoffload", NULL); - const char *target_so_filename = save_temps - ? concat (dumppfx, "_offload_intelmic.so", NULL) - : make_temp_file ("_offload_intelmic.so"); - temp_files[num_temps++] = target_so_filename; - struct obstack argv_obstack; - obstack_init (&argv_obstack); - obstack_ptr_grow (&argv_obstack, target_compiler); - if (save_temps) - obstack_ptr_grow (&argv_obstack, "-save-temps"); - if (verbose) - obstack_ptr_grow (&argv_obstack, "-v"); - obstack_ptr_grow (&argv_obstack, "-xlto"); - obstack_ptr_grow (&argv_obstack, opt1); - for (int i = 1; i < argc; i++) - { - if (!strcmp (argv[i], "-o") && i + 1 != argc) - ++i; - else - obstack_ptr_grow (&argv_obstack, argv[i]); - } - obstack_ptr_grow (&argv_obstack, opt2); - /* NB: Put -fPIC and -shared the last to create shared library. */ - obstack_ptr_grow (&argv_obstack, "-fPIC"); - obstack_ptr_grow (&argv_obstack, "-shared"); - obstack_ptr_grow (&argv_obstack, "-dumpdir"); - obstack_ptr_grow (&argv_obstack, ""); - obstack_ptr_grow (&argv_obstack, "-dumpbase"); - obstack_ptr_grow (&argv_obstack, dump_filename); - obstack_ptr_grow (&argv_obstack, "-dumpbase-ext"); - obstack_ptr_grow (&argv_obstack, ""); - obstack_ptr_grow (&argv_obstack, "-o"); - obstack_ptr_grow (&argv_obstack, target_so_filename); - - char *omp_requires_file; - if (save_temps) - omp_requires_file = concat (dumppfx, ".mkoffload.omp_requires", NULL); - else - omp_requires_file = make_temp_file (".mkoffload.omp_requires"); - temp_files[num_temps++] = omp_requires_file; - xputenv (concat ("GCC_OFFLOAD_OMP_REQUIRES_FILE=", omp_requires_file, NULL)); - - compile_for_target (&argv_obstack); - - unsetenv("GCC_OFFLOAD_OMP_REQUIRES_FILE"); - FILE *in = fopen (omp_requires_file, "rb"); - if (!in) - fatal_error (input_location, "cannot open omp_requires file %qs", - omp_requires_file); - if (fread (omp_requires, sizeof (*omp_requires), 1, in) != 1) - fatal_error (input_location, "cannot read omp_requires file %qs", - omp_requires_file); - fclose (in); - - /* Run objcopy. */ - char *rename_section_opt - = XALLOCAVEC (char, sizeof (".data=") + strlen (image_section_name)); - sprintf (rename_section_opt, ".data=%s", image_section_name); - obstack_init (&argv_obstack); - obstack_ptr_grow (&argv_obstack, "objcopy"); - obstack_ptr_grow (&argv_obstack, "-B"); - obstack_ptr_grow (&argv_obstack, "i386"); - obstack_ptr_grow (&argv_obstack, "-I"); - obstack_ptr_grow (&argv_obstack, "binary"); - obstack_ptr_grow (&argv_obstack, "-O"); - switch (offload_abi) - { - case OFFLOAD_ABI_LP64: - obstack_ptr_grow (&argv_obstack, "elf64-x86-64"); - break; - case OFFLOAD_ABI_ILP32: - obstack_ptr_grow (&argv_obstack, "elf32-i386"); - break; - default: - gcc_unreachable (); - } - obstack_ptr_grow (&argv_obstack, target_so_filename); - obstack_ptr_grow (&argv_obstack, "--rename-section"); - obstack_ptr_grow (&argv_obstack, rename_section_opt); - obstack_ptr_grow (&argv_obstack, NULL); - char **new_argv = XOBFINISH (&argv_obstack, char **); - fork_execute (new_argv[0], new_argv, false, NULL); - obstack_free (&argv_obstack, NULL); - - /* Objcopy has created symbols, containing the input file name with - non-alphanumeric characters replaced by underscores. - We are going to rename these new symbols. */ - size_t symbol_name_len = strlen (target_so_filename); - char *symbol_name = XALLOCAVEC (char, symbol_name_len + 1); - for (size_t i = 0; i < symbol_name_len; i++) - { - char c = target_so_filename[i]; - if (!ISALNUM (c)) - c = '_'; - symbol_name[i] = c; - } - symbol_name[symbol_name_len] = '\0'; - - char *opt_for_objcopy[3]; - opt_for_objcopy[0] = XALLOCAVEC (char, sizeof ("_binary__start=") - + symbol_name_len - + strlen (symbols[0])); - opt_for_objcopy[1] = XALLOCAVEC (char, sizeof ("_binary__end=") - + symbol_name_len - + strlen (symbols[1])); - opt_for_objcopy[2] = XALLOCAVEC (char, sizeof ("_binary__size=") - + symbol_name_len - + strlen (symbols[2])); - sprintf (opt_for_objcopy[0], "_binary_%s_start=%s", symbol_name, symbols[0]); - sprintf (opt_for_objcopy[1], "_binary_%s_end=%s", symbol_name, symbols[1]); - sprintf (opt_for_objcopy[2], "_binary_%s_size=%s", symbol_name, symbols[2]); - - obstack_init (&argv_obstack); - obstack_ptr_grow (&argv_obstack, "objcopy"); - obstack_ptr_grow (&argv_obstack, target_so_filename); - obstack_ptr_grow (&argv_obstack, "--redefine-sym"); - obstack_ptr_grow (&argv_obstack, opt_for_objcopy[0]); - obstack_ptr_grow (&argv_obstack, "--redefine-sym"); - obstack_ptr_grow (&argv_obstack, opt_for_objcopy[1]); - obstack_ptr_grow (&argv_obstack, "--redefine-sym"); - obstack_ptr_grow (&argv_obstack, opt_for_objcopy[2]); - obstack_ptr_grow (&argv_obstack, NULL); - new_argv = XOBFINISH (&argv_obstack, char **); - fork_execute (new_argv[0], new_argv, false, NULL); - obstack_free (&argv_obstack, NULL); - - return target_so_filename; -} - -int -main (int argc, char **argv) -{ - progname = "mkoffload-intelmic"; - gcc_init_libintl (); - diagnostic_initialize (global_dc, 0); - - if (atexit (mkoffload_cleanup) != 0) - fatal_error (input_location, "atexit failed"); - - const char *host_compiler = getenv ("COLLECT_GCC"); - if (!host_compiler) - fatal_error (input_location, "COLLECT_GCC must be set"); - - const char *target_driver_name = GCC_INSTALL_NAME; - char *target_compiler = find_target_compiler (target_driver_name); - if (target_compiler == NULL) - fatal_error (input_location, "offload compiler %s not found", - target_driver_name); - - /* We may be called with all the arguments stored in some file and - passed with @file. Expand them into argv before processing. */ - expandargv (&argc, &argv); - - /* Scan the argument vector. */ - for (int i = 1; i < argc; i++) - { -#define STR "-foffload-abi=" - if (startswith (argv[i], STR)) - { - if (strcmp (argv[i] + strlen (STR), "lp64") == 0) - offload_abi = OFFLOAD_ABI_LP64; - else if (strcmp (argv[i] + strlen (STR), "ilp32") == 0) - offload_abi = OFFLOAD_ABI_ILP32; - else - fatal_error (input_location, - "unrecognizable argument of option " STR); - } -#undef STR - else if (strcmp (argv[i], "-save-temps") == 0) - save_temps = true; - else if (strcmp (argv[i], "-v") == 0) - verbose = true; - else if (strcmp (argv[i], "-dumpbase") == 0 - && i + 1 < argc) - dumppfx = argv[++i]; - else if (strcmp (argv[i], "-o") == 0 - && i + 1 < argc) - out_obj_filename = argv[++i]; - } - - if (!out_obj_filename) - fatal_error (input_location, "output file not specified"); - - if (!dumppfx) - dumppfx = out_obj_filename; - - uint32_t omp_requires; - - const char *target_so_filename - = prepare_target_image (target_compiler, argc, argv, &omp_requires); - - const char *host_descr_filename - = generate_host_descr_file (host_compiler, omp_requires); - - /* Perform partial linking for the target image and host side descriptor. - As a result we'll get a finalized object file with all offload data. */ - struct obstack argv_obstack; - obstack_init (&argv_obstack); - obstack_ptr_grow (&argv_obstack, "ld"); - obstack_ptr_grow (&argv_obstack, "-m"); - switch (offload_abi) - { - case OFFLOAD_ABI_LP64: - obstack_ptr_grow (&argv_obstack, "elf_x86_64"); - break; - case OFFLOAD_ABI_ILP32: - obstack_ptr_grow (&argv_obstack, "elf_i386"); - break; - default: - gcc_unreachable (); - } - obstack_ptr_grow (&argv_obstack, "--relocatable"); - obstack_ptr_grow (&argv_obstack, host_descr_filename); - obstack_ptr_grow (&argv_obstack, target_so_filename); - obstack_ptr_grow (&argv_obstack, "-o"); - obstack_ptr_grow (&argv_obstack, out_obj_filename); - obstack_ptr_grow (&argv_obstack, NULL); - char **new_argv = XOBFINISH (&argv_obstack, char **); - fork_execute (new_argv[0], new_argv, false, NULL); - obstack_free (&argv_obstack, NULL); - - /* Run objcopy on the resultant object file to localize generated symbols - to avoid conflicting between different DSO and an executable. */ - obstack_init (&argv_obstack); - obstack_ptr_grow (&argv_obstack, "objcopy"); - obstack_ptr_grow (&argv_obstack, "-L"); - obstack_ptr_grow (&argv_obstack, symbols[0]); - obstack_ptr_grow (&argv_obstack, "-L"); - obstack_ptr_grow (&argv_obstack, symbols[1]); - obstack_ptr_grow (&argv_obstack, "-L"); - obstack_ptr_grow (&argv_obstack, symbols[2]); - obstack_ptr_grow (&argv_obstack, out_obj_filename); - obstack_ptr_grow (&argv_obstack, NULL); - new_argv = XOBFINISH (&argv_obstack, char **); - fork_execute (new_argv[0], new_argv, false, NULL); - obstack_free (&argv_obstack, NULL); - - return 0; -} diff --git a/gcc/config/i386/intelmic-offload.h b/gcc/config/i386/intelmic-offload.h deleted file mode 100644 index 42ce0d8..0000000 --- a/gcc/config/i386/intelmic-offload.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Support for Intel MIC offloading. - - Copyright (C) 2014-2022 Free Software Foundation, Inc. - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - GCC is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - Under Section 7 of GPL version 3, you are granted additional - permissions described in the GCC Runtime Library Exception, version - 3.1, as published by the Free Software Foundation. - - You should have received a copy of the GNU General Public License and - a copy of the GCC Runtime Library Exception along with this program; - see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef INTELMIC_OFFLOAD_H -#define INTELMIC_OFFLOAD_H - -/* Support for OpenACC acc_on_device. */ - -#include "gomp-constants.h" - -#define ACCEL_COMPILER_acc_device GOMP_DEVICE_INTEL_MIC - -#endif diff --git a/gcc/config/i386/t-intelmic b/gcc/config/i386/t-intelmic deleted file mode 100644 index 95d7e53..0000000 --- a/gcc/config/i386/t-intelmic +++ /dev/null @@ -1,10 +0,0 @@ -CFLAGS-mkoffload.o += $(DRIVER_DEFINES) -DGCC_INSTALL_NAME=\"$(GCC_INSTALL_NAME)\" - -mkoffload.o: $(srcdir)/config/i386/intelmic-mkoffload.cc - $(COMPILE) $< - $(POSTCOMPILE) -ALL_HOST_OBJS += mkoffload.o - -mkoffload$(exeext): mkoffload.o collect-utils.o libcommon-target.a $(LIBIBERTY) $(LIBDEPS) - $(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ - mkoffload.o collect-utils.o libcommon-target.a $(LIBIBERTY) $(LIBS) diff --git a/gcc/config/i386/t-omp-device b/gcc/config/i386/t-omp-device deleted file mode 100644 index cfb41ed..0000000 --- a/gcc/config/i386/t-omp-device +++ /dev/null @@ -1,6 +0,0 @@ -omp-device-properties-i386: $(srcdir)/config/i386/i386-options.cc - echo kind: cpu > $@ - echo arch: intel_mic x86 x86_64 i386 i486 i586 i686 ia32 >> $@ - echo isa: sse4 `sed -n '/^static struct ix86_target_opts isa2\?_opts\[\] =/,/^};/p' \ - $(srcdir)/config/i386/i386-options.cc | \ - sed -n 's/",.*$$//;s/^ { "-m//p'` >> $@ diff --git a/gcc/configure b/gcc/configure index e55c656..aa09609 100755 --- a/gcc/configure +++ b/gcc/configure @@ -8253,12 +8253,6 @@ if test x"$enable_as_accelerator_for" != x; then $as_echo "#define ACCEL_COMPILER 1" >>confdefs.h enable_as_accelerator=yes - case "${target}" in - *-intelmicemul-*) - # In this case we expect offload compiler to be built as native, so we - # need to rename the driver to avoid clashes with host's drivers. - program_transform_name="s&^&${target}-&" ;; - esac sedscript="s#${target_noncanonical}#${enable_as_accelerator_for}-accel-${target_noncanonical}#" program_transform_name=`echo $program_transform_name | sed $sedscript` accel_dir_suffix=/accel/${target_noncanonical} @@ -8273,10 +8267,6 @@ for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do enable_offloading=1 case "$tgt" in - *-intelmic-* | *-intelmicemul-*) - omp_device_property=omp-device-properties-i386 - omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/i386/t-omp-device" - ;; amdgcn*) omp_device_property=omp-device-properties-gcn omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/gcn/t-omp-device" @@ -19720,7 +19710,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19723 "configure" +#line 19713 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19826,7 +19816,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19829 "configure" +#line 19819 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 9ca7779..7c55bff 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1136,12 +1136,6 @@ if test x"$enable_as_accelerator_for" != x; then AC_DEFINE(ACCEL_COMPILER, 1, [Define if this compiler should be built as the offload target compiler.]) enable_as_accelerator=yes - case "${target}" in - *-intelmicemul-*) - # In this case we expect offload compiler to be built as native, so we - # need to rename the driver to avoid clashes with host's drivers. - program_transform_name="s&^&${target}-&" ;; - esac sedscript="s#${target_noncanonical}#${enable_as_accelerator_for}-accel-${target_noncanonical}#" program_transform_name=`echo $program_transform_name | sed $sedscript` accel_dir_suffix=/accel/${target_noncanonical} @@ -1156,10 +1150,6 @@ for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do enable_offloading=1 case "$tgt" in - *-intelmic-* | *-intelmicemul-*) - omp_device_property=omp-device-properties-i386 - omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/i386/t-omp-device" - ;; amdgcn*) omp_device_property=omp-device-properties-gcn omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/gcn/t-omp-device" diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index c1876f2..a01b805 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -2337,7 +2337,7 @@ specifying paths @var{path1}, @dots{}, @var{pathN}. @smallexample % @var{srcdir}/configure \ - --enable-offload-targets=x86_64-intelmicemul-linux-gnu=/path/to/x86_64/compiler,nvptx-none + --enable-offload-targets=amdgcn-amdhsa,nvptx-none @end smallexample @item --enable-offload-defaulted diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 5de5e95..17a6f21 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -116,9 +116,6 @@ The runtime support library for transactional memory. @item libobjc The Objective-C and Objective-C++ runtime library. -@item liboffloadmic -A library to allow OpenMP to Intel MIC targets. - @item libphobos The D standard and runtime library. The bulk of this library is mirrored from the @uref{https://github.com/@/dlang, master D repositories}. |