Skip to content

Commit 561e71a

Browse files
authored
Merge branch 'master' into cmake2
2 parents 458ebb5 + a0a67c5 commit 561e71a

File tree

315 files changed

+11548
-2571
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

315 files changed

+11548
-2571
lines changed

include/flang/Error/errmsg-accel.n

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,13 @@
8484
.MS S 1039 "OpenACC data clause expected after $"
8585
.MS S 1040 "OpenACC $ data clause may not follow a device_type clause."
8686
.MS S 1041 "OpenACC $ clause may not follow a device_type clause."
87+
.MS W 1042 "acc loop vector clause ignored because of inner vector loop."
88+
Nested acc loop vector directives will not be honored if the loops cannot be
89+
effectively collapsed or tiled.
90+
.MS W 1043 "acc loop worker clause ignored because of inner worker loop."
91+
Nested acc loop worker directives will not be honored if the loops cannot be
92+
effectively collapsed or tiled.
93+
.MS S 1044 "acc loop gang not allowed in an acc routine($) procedure."
94+
.MS S 1045 "call to acc routine(gang$) procedure not allowed in acc loop $."
95+
.MS S 1046 "OpenACC compute region ignored: no parallel kernels found."
96+
.MS S 1047 "Inner collapsed loop bounds are not invariant in outer loop."

include/flang/Error/errmsg-common.n

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\"/*
2-
.\" * Copyright (c) 2010-2018, NVIDIA CORPORATION. All rights reserved.
2+
.\" * Copyright (c) 2010-2019, NVIDIA CORPORATION. All rights reserved.
33
.\" *
44
.\" * Licensed under the Apache License, Version 2.0 (the "License");
55
.\" * you may not use this file except in compliance with the License.
@@ -28,3 +28,4 @@ We have one spot for the preinclude file in the gbl. structure. This is not
2828
a user visible switch.
2929
.MS F 704 "Compilation aborted due to previous errors."
3030
Compilation will abort immediately in case of Severe or Fatal error.
31+
.MS F 705 "Half precision implementation missing support - $"

include/flang/Error/errmsg.n

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\"/*
2-
.\" * Copyright (c) 1994-2018, NVIDIA CORPORATION. All rights reserved.
2+
.\" * Copyright (c) 1994-2019, NVIDIA CORPORATION. All rights reserved.
33
.\" *
44
.\" * Licensed under the Apache License, Version 2.0 (the "License");
55
.\" * you may not use this file except in compliance with the License.
@@ -717,3 +717,4 @@ Please update your licenses to use this feature.
717717
.MS S 1200 "OpenMP GPU - [$] is used, it is not implemented yet."
718718
.MS S 1201 "OpenMP GPU - [$] is used with [$], this usage is not implemented yet."
719719
.MS S 1202 "OpenMP GPU - [$] is used independently than [$], this usage is not implemented yet."
720+
.MS S 1204 "OpenMP GPU - Internal compiler error. Reason: [$] at [$]"

lib/scutil/pgnewfil.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
2+
* Copyright (c) 2006-2019, NVIDIA CORPORATION. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -79,7 +79,12 @@ addn(char *p, unsigned long val, int n)
7979
return p;
8080
} /* addn */
8181

82-
static long pgrand = 0;
82+
#ifdef HOST_WIN
83+
#define LONG long long
84+
#else
85+
#define LONG long
86+
#endif
87+
static LONG pgrand = 0;
8388
static unsigned long pid = 0;
8489

8590
#if defined(USETEMPNAM) || defined(HOST_WIN) || defined(WIN64)
@@ -109,15 +114,15 @@ gentmp(char *pfx, char *sfx)
109114
if (pgrand == 0) { /* first time, create seed */
110115
char *q;
111116
q = getenv("PATH");
112-
pgrand = (long)q;
117+
pgrand = (LONG)q;
113118
q = getenv("USER");
114119
if (q != NULL) {
115120
int n = 0;
116121
while (*q != '\0') {
117-
pgrand ^= (long)(*q++) << n++;
122+
pgrand ^= (LONG)(*q++) << n++;
118123
}
119124
}
120-
pgrand ^= (long)filename >> 4;
125+
pgrand ^= (LONG)filename >> 4;
121126
pgrand ^= time((long *)0);
122127
pid = getpid();
123128
#if DEBUG
@@ -153,7 +158,7 @@ gentmp(char *pfx, char *sfx)
153158
pgrand = (pgrand << 16) + pgrand * 3;
154159
p = addn(p, pgrand, 4);
155160
pgrand = (pgrand << 16) + pgrand * 3;
156-
p = addn(p, pgrand ^ (((long)(pfx) ^ (long)(sfx)) >> 5), 4);
161+
p = addn(p, pgrand ^ (((LONG)(pfx) ^ (LONG)(sfx)) >> 5), 4);
157162
if (sfx)
158163
p = add(p, sfx);
159164
return filename;

runtime/flang/CMakeLists.txt

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
2+
# Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -204,6 +204,8 @@ SET(FTN_INTRINSICS_DESC_DEP
204204
red_minloc.c
205205
red_maxval.c
206206
red_minval.c
207+
red_norm2.c
208+
red_norm2_stride1.c
207209
red_sum.c
208210
reduct.c
209211
scatter.c
@@ -419,24 +421,39 @@ SET(FTN_SUPPORT_DESC_DEP
419421
)
420422

421423
set(I8_FILES_DIR I8_sources)
424+
separate_arguments(SEPARATED_CMAKE_Fortran_FLAGS NATIVE_COMMAND ${CMAKE_Fortran_FLAGS})
422425

423-
# Fortran files with macros as module names need to be preprocessed.
426+
# Fortran files with macros as module names need to be preprocessed.
427+
# CMake has an internal Fortran parser that parses the module name, but it doesn't
428+
# consider macros which results in wrong dependencies.
424429
add_custom_command(
425430
OUTPUT "${I8_FILES_DIR}/ieee_arithmetic.F95"
426-
COMMAND "${CMAKE_C_COMPILER}" -E
431+
COMMAND "${CMAKE_Fortran_COMPILER}" -E -cpp ${SEPARATED_CMAKE_Fortran_FLAGS}
427432
"${CMAKE_CURRENT_SOURCE_DIR}/ieee_arithmetic.F95" -DDESC_I8
428433
> "${I8_FILES_DIR}/ieee_arithmetic.F95"
429434
COMMENT "Preprocessing ieee_arithmetic.F95"
430435
VERBATIM
436+
DEPENDS flang1 flang2
431437
)
432438

433439
add_custom_command(
434440
OUTPUT "${I8_FILES_DIR}/ieee_exceptions.F95"
435-
COMMAND "${CMAKE_C_COMPILER}" -E
441+
COMMAND "${CMAKE_Fortran_COMPILER}" -E -cpp ${SEPARATED_CMAKE_Fortran_FLAGS}
436442
"${CMAKE_CURRENT_SOURCE_DIR}/ieee_exceptions.F95" -DDESC_I8
437443
> "${I8_FILES_DIR}/ieee_exceptions.F95"
438444
COMMENT "Preprocessing ieee_exceptions.F95"
439445
VERBATIM
446+
DEPENDS flang1 flang2
447+
)
448+
449+
add_custom_command(
450+
OUTPUT ${I8_FILES_DIR}/norm2_1.F95 norm2_1.F95
451+
COMMAND "${CMAKE_Fortran_COMPILER}" -E -DDESC_I8 -DPGFLANG -cpp ${SEPARATED_CMAKE_Fortran_FLAGS}
452+
${CMAKE_CURRENT_SOURCE_DIR}/norm2.F95 > "${I8_FILES_DIR}/norm2_1.F95"
453+
COMMAND "${CMAKE_Fortran_COMPILER}" -E -DPGFLANG -cpp ${SEPARATED_CMAKE_Fortran_FLAGS}
454+
${CMAKE_CURRENT_SOURCE_DIR}/norm2.F95 > "norm2_1.F95"
455+
VERBATIM
456+
DEPENDS flang1 flang2
440457
)
441458

442459
# The files lists FTN_INTRINSICS_DESC_DEP and FTN_SUPPORT_DESC_DEP need to be compiled twice (with and without 'DESC_I8' compile definition). So an actual copy is made in a temp file on which this is done.
@@ -453,10 +470,12 @@ FOREACH(file ${FTN_SUPPORT_DESC_DEP})
453470
LIST(APPEND FTN_SUPPORT_I8 ${I8_FILE})
454471
ENDFOREACH(file)
455472

456-
LIST(APPEND FTN_SUPPORT_DESC_DEP ieee_arithmetic.F95)
457-
LIST(APPEND FTN_SUPPORT_DESC_DEP ieee_exceptions.F95)
458-
LIST(APPEND FTN_SUPPORT_I8 "${I8_FILES_DIR}/ieee_arithmetic.F95")
459-
LIST(APPEND FTN_SUPPORT_I8 "${I8_FILES_DIR}/ieee_exceptions.F95")
473+
LIST(APPEND FTN_SUPPORT_DESC_DEP ieee_arithmetic.F95 ieee_exceptions.F95 norm2_1.F95)
474+
LIST(APPEND FTN_SUPPORT_I8
475+
"${I8_FILES_DIR}/ieee_arithmetic.F95"
476+
"${I8_FILES_DIR}/ieee_exceptions.F95"
477+
"${I8_FILES_DIR}/norm2_1.F95"
478+
)
460479

461480
add_flang_library(flang_static
462481
${FTN_INTRINSICS_DESC_INDEP}
@@ -488,6 +507,16 @@ add_flang_library(flang_shared
488507
${SHARED_SOURCES}
489508
)
490509
set_property(TARGET flang_shared PROPERTY OUTPUT_NAME flang)
510+
#
511+
# Seralize the building of flang_shared and flang_static to eliminate
512+
# conflicts with the same module files from the shared and static builds
513+
# being created/recreated in the common directory
514+
# ${CMAKE_Fortran_MODULE_DIRECTORY}.
515+
#
516+
# Note: building of each library is still parallelized.
517+
#
518+
add_dependencies(flang_shared flang_static)
519+
491520
target_link_libraries(flang_shared flangrti_shared)
492521
# Resolve symbols against libm and librt
493522
if (NOT MSVC)
@@ -542,6 +571,13 @@ set_property(
542571
PG_PIC
543572
)
544573

574+
set_source_files_properties(
575+
${I8_FILES_DIR}/red_norm2_stride1.c
576+
red_norm2_stride1.c
577+
PROPERTIES
578+
COMPILE_FLAGS "-ffast-math"
579+
)
580+
545581
set_target_properties(flang_static flang_shared
546582
PROPERTIES
547583
ARCHIVE_OUTPUT_DIRECTORY ${FLANG_RTE_LIB_DIR}

runtime/flang/allo.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1995-2018, NVIDIA CORPORATION. All rights reserved.
2+
* Copyright (c) 1995-2019, NVIDIA CORPORATION. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -1190,14 +1190,17 @@ ENTF90(PTR_SRC_ALLOC03A, ptr_src_alloc03a)(F90_Desc *sd, __INT_T *nelem,
11901190
src_len = ENTF90(GET_OBJECT_SIZE, get_object_size)(sd);
11911191
if (sd && sd->tag == __DESC && sd->lsize > 1)
11921192
src_len *= sd->lsize;
1193+
else if (nelem && *nelem > 1) {
1194+
src_len *= *nelem;
1195+
}
11931196
max_len = (len && nelem) ? (*len * *nelem) : 0;
11941197
if (max_len < src_len)
11951198
max_len = src_len;
11961199

11971200
if (ISPRESENT(stat) && firsttime && *firsttime)
11981201
*stat = 0;
11991202

1200-
(void)I8(__alloc04)(*nelem, (dtype)*kind, (size_t)max_len, stat, pointer,
1203+
(void)I8(__alloc04)(1, (dtype)*kind, (size_t)max_len, stat, pointer,
12011204
offset, 0, 0, LOCAL_MODE ? __fort_malloc_without_abort
12021205
: __fort_gmalloc_without_abort,
12031206
0, CADR(errmsg), CLEN(errmsg));
@@ -1225,16 +1228,19 @@ ENTF90(PTR_SRC_CALLOC03A, ptr_src_calloc03a)(F90_Desc *sd, __INT_T *nelem,
12251228
__INT_T src_len, max_len;
12261229

12271230
src_len = ENTF90(GET_OBJECT_SIZE, get_object_size)(sd);
1228-
if (sd && sd->tag == __DESC && sd->lsize > 1)
1231+
if (sd && sd->tag == __DESC && sd->lsize > 1) {
12291232
src_len *= sd->lsize;
1233+
} else if (nelem && *nelem > 1) {
1234+
src_len *= *nelem;
1235+
}
12301236
max_len = (len && nelem) ? (*len * *nelem) : 0;
12311237
if (max_len < src_len)
12321238
max_len = src_len;
12331239

12341240
if (ISPRESENT(stat) && firsttime && *firsttime)
12351241
*stat = 0;
12361242

1237-
(void)I8(__alloc04)(*nelem, (dtype)*kind, (size_t)max_len, stat, pointer,
1243+
(void)I8(__alloc04)(1, (dtype)*kind, (size_t)max_len, stat, pointer,
12381244
offset, 0, 0, LOCAL_MODE ? __fort_calloc_without_abort
12391245
: __fort_gcalloc_without_abort,
12401246
0, CADR(errmsg), CLEN(errmsg));
@@ -1264,14 +1270,17 @@ ENTF90(PTR_SRC_ALLOC04A, ptr_src_alloc04a)(F90_Desc *sd, __NELEM_T *nelem,
12641270
src_len = ENTF90(GET_OBJECT_SIZE, get_object_size)(sd);
12651271
if (sd && sd->tag == __DESC && sd->lsize > 1)
12661272
src_len *= sd->lsize;
1273+
else if (nelem && *nelem > 1) {
1274+
src_len *= *nelem;
1275+
}
12671276
max_len = (len && nelem) ? (*len * *nelem) : 0;
12681277
if (max_len < src_len)
12691278
max_len = src_len;
12701279

12711280
if (ISPRESENT(stat) && firsttime && *firsttime)
12721281
*stat = 0;
12731282

1274-
(void)I8(__alloc04)(*nelem, (dtype)*kind, (size_t)max_len, stat, pointer,
1283+
(void)I8(__alloc04)(1, (dtype)*kind, (size_t)max_len, stat, pointer,
12751284
offset, 0, 0, LOCAL_MODE ? __fort_malloc_without_abort
12761285
: __fort_gmalloc_without_abort,
12771286
*align, CADR(errmsg), CLEN(errmsg));
@@ -1309,6 +1318,8 @@ ENTF90(PTR_SRC_CALLOC04A, ptr_src_calloc04a)
13091318
sd->kind > 0 && sd->kind <= __NTYPES) {
13101319
src_len = sd->len;
13111320
}
1321+
} else if (nelem && *nelem > 1) {
1322+
src_len *= *nelem;
13121323
}
13131324
max_len = (len && nelem) ? (*len * *nelem) : 0;
13141325
if (max_len < src_len)
@@ -1317,7 +1328,7 @@ ENTF90(PTR_SRC_CALLOC04A, ptr_src_calloc04a)
13171328
if (ISPRESENT(stat) && firsttime && *firsttime)
13181329
*stat = 0;
13191330

1320-
(void)I8(__alloc04)(*nelem, (dtype)*kind, (size_t)max_len, stat, pointer,
1331+
(void)I8(__alloc04)(1, (dtype)*kind, (size_t)max_len, stat, pointer,
13211332
offset, 0, 0, LOCAL_MODE ? __fort_calloc_without_abort
13221333
: __fort_gcalloc_without_abort,
13231334
*align, CADR(errmsg), CLEN(errmsg));

runtime/flang/dbug.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1995-2018, NVIDIA CORPORATION. All rights reserved.
2+
* Copyright (c) 1995-2019, NVIDIA CORPORATION. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -362,7 +362,8 @@ void ENTFTN(SHOW, show)(void *b, F90_Desc *d)
362362
}
363363
}
364364

365-
void ENTF90(SHOW_, show_)(void *b, F90_Desc *d)
365+
#if (defined(DESC_I8) && defined(__PGLLVM__)) || (!defined(DESC_I8) && !defined(__PGLLVM__))
366+
void ENTF90COMN(SHOW_, show_)(void *b, F90_Desc *d)
366367
{
367368
DECL_HDR_PTRS(t);
368369
DECL_DIM_PTRS(td);
@@ -410,6 +411,7 @@ void ENTF90(SHOW_, show_)(void *b, F90_Desc *d)
410411
}
411412
}
412413
}
414+
#endif /* (defined(DESC_I8) && defined(__PGLLVM__)) || (!defined(DESC_I8) && !defined(__PGLLVM__)) */
413415

414416
void I8(__fort_describe)(char *b, F90_Desc *d)
415417
{

runtime/flang/directives.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#define ELF_OBJ(s) .type ENT(s), @object
5353
#define ELF_SIZE(s) .size ENT(s), .- ENT(s)
5454
#endif
55+
#define ELF_HIDDEN(s)
5556
#define AS_VER .version "01.01"
5657
#define I1 %rcx
5758
#define I1W %ecx
@@ -87,6 +88,7 @@
8788
#define ELF_FUNC(s) .type ENT(s), @function
8889
#define ELF_OBJ(s) .type ENT(s), @object
8990
#define ELF_SIZE(s) .size ENT(s), .- ENT(s)
91+
#define ELF_HIDDEN(s) .globl s ; .hidden s
9092
#define AS_VER .version "01.01"
9193
#define I1 %rdi
9294
#define I1W %edi
@@ -110,6 +112,7 @@
110112
#define ELF_FUNC(s)
111113
#define ELF_OBJ(s)
112114
#define ELF_SIZE(s)
115+
#define ELF_HIDDEN(s)
113116
#define AS_VER
114117
#define I1 %rdi
115118
#define I1W %edi

0 commit comments

Comments
 (0)