Граф коммитов

1185 Коммитов

Автор SHA1 Сообщение Дата
Greg Roth 168aad3b41 [spirv] Multiplex ModuleBuilder decorations (#1351)
ModuleBuilder had a catch-all function to apply decorations not
taking additional parameters, however, every single call to this
has an explicit decoration parameter. The switch only slows things
down and doesn't help with code length or anything else. The switch
is missing the other decorations that have custom functions, which
produce warnings. Rather than add a default: case, I've provided
custom decorate functions for each decoration.
2018-06-17 08:05:08 -04:00
Greg Roth 5481aca58f [linux-port] Remove unused from HLSL code (#1315)
Removes unused variables and functions from code between HLSL
change comments in LLVM code or else in HLSL or SPIRV original
source files along with any code correspondingly rendered unused
or originally in service of these ultimately unused elements.
Each of these produces a warning in clang, gcc, or both.
Fixes around 458 clang warnings and 461 gcc warnings.
2018-06-17 08:03:25 -04:00
Greg Roth fdc414caa0 Fix warning on windows release builds (#1350)
A persistent and occasionally confusing warning is produced on
Windows release builds because of a conditional expression that only
contains an assert. On a release build, this amounts to nothing but
a semicolon, which produces the warning.

This folds the conditional into the previously explicit assert so
it is included or excluded entirely regardless of build type.
2018-06-16 10:05:45 +08:00
Ehsan eb37d4ae2b
[spirv] Update SPIRV-Tools. (#1348) 2018-06-12 15:00:48 -04:00
Helena Kotas c3587a82fb
Update to VS 2017 and CMake 3.11.2 (#1347)
* Change build to prefer VS 2017

* Update supported cmake version

* Remove -vs2017 from appveyor.yml
2018-06-08 17:36:55 -07:00
Greg Roth ccbb0ec117 [linux-port] Add missing case statements (#1346)
When switching over an enum value, the ideal is to include a case
for every possibly value. Where possible, that's what this change
does to silence warnings and also to provide space to properly
handle every possible input and throw a warning should a new one
be added. In some cases, it's not practical to list every input.
In these cases, putting a default that doesn't change the behavior,
but let's the compiler know that the behavior is intended.
Fixes 133 clang and 8108(!) gcc warnings.
2018-06-08 20:19:52 -04:00
Helena Kotas 7fd91d777f
Modify build script and environment to support ARM64 build (#1308)
hctstart.cmd and hctbuild.cmd now support ARM64 builds.

Note that building ARM64 build on x86/x64 machine needs a location
of x86/x64 version of TableGen tools (clang-tblgen and llvm-tblgen).
Before starting ARM64 build set the BUILD_TBLGEN_PATH to point to
the TableGen binaries or use the -tblgen option on hctbuild.cmd.

Also had to rearrange control flow around the cmake --build call
in hctbuild.cmd due to a flaky batch behavior around brackets.
2018-06-08 13:06:48 -07:00
Greg Roth 6121df782a [linux-port] Correct problematic initializations (#1321)
Regardless of the order of variables placed in a constructor
member initializer list, the variables are initialized in the
order they are listed in the class or struct. This can cause
issues where the assignment of one variable depends on the other.
For this reason, a warning is produced if the member variables
are listed in a different order. This change moves the member
initializer lists into the order they were being initialized.
Fixes 23 clang and 24 gcc warnings.

Initialization of members of a larger aggregate type may benefit
from braces to clarify which variables are expected to go where.
At the same time, scalars should not be so segregated. This places
or removes such braces wherever appropriate.
Fixes 144 clang warnings
2018-06-08 07:19:20 +08:00
Greg Roth 0ba5e55bf3 [linux-port] Use cross-platform TLS methods (#1338)
LLVM includes cross-platform thread local storage methods for
saving, retrieving, and deleting thread-specific objects. Using
these methods is superior to the thread_local storage qualifier
because the former works on Apple, Linux, and Windows. It also
uses the same mechanism as the previous Windows implementation
used without compiler idiosyncracies.

Placement new is needed in DxcInitThreadMalloc because operator
new requires the TLS malloc to be in place.
2018-06-07 13:32:57 -04:00
Greg Roth a88cc5d133 [linux-port] de-const variables not used as const (#1331)
pParameters and pStaticSamplers were both marked const in spite of
the qualifier being cast off at nearly every usage. So they lose
their const. If you're the target of memcpy or memset, you are
not const.
Fixes 12 gcc and 12 clang warnings
2018-06-07 13:04:20 -04:00
Greg Roth a89e4e48f1 [linux-port] Casts for compares and assigns (#1328)
Various comparisons produce warnings because the values differ in
signedness. This either changes the type of one of the parameters
or else it casts one. This includes adding casts to all of the
defined return error values. Which is more than was needed, but
consistent with some existing values anyway.
Fixes 11 clang and 12 gcc warnings.

Eliminate a few greater than or equal comparisons of unsigned
values which are always true. The most aggressive of this is
the exclusion of a function that has become a no-op because of
HLSL initialization of a key variable that had some invalid
comparisons because of the same const value.
Fixes 4 clang and 7 gcc warnings.

Additionally casts a few parameters to the proper type to silence
warnings about confusing or problem casts. This includes printing
functions, array indices, and deletes of void pointers. The latter
of which might have caused problems.
Fixes 6 clang 6 gcc warnings.

One incidental change that silences a warning about security for
using a string variable as the format for printf. Since it just
outputs the string, fputs is more appropriate anyway. Also
directed to stderr as more appropriate for debug info.
2018-06-07 12:49:02 -04:00
Ehsan b102541771
[spirv] Append must load lvalues before appending (#1345)
The AppendStructuredBuffer's Append method was not checking for lvalues.
2018-06-07 08:32:52 -04:00
Greg Roth b9f2c78314 [linux-port] Evade unused in LLVM code (#1327)
Primarily if not exclusively due to the massive carveouts of the
original LLVM source base as part of the HLSL adaptation, many
variables and functions are left unused. In keeping with the
practice of commenting or ifdef-ing out unused portions of this
code and marking every such exclusion as an HLSL change, this adds
few comments and moves a lot of preprocessor conditionals around to
encompass the portions left unused as a consequence of the earlier
exclusions.
Fixes 450 clang and 442 gcc warnings.
2018-06-05 14:07:51 -04:00
Greg Roth e5ec4ca0db [linux-port] Replace tests of never null addresses (#1318)
Found as part of a project to eliminate warnings, but this is an
actual bug. An HLSL change adds the possibility of a Dxil and an
HLSL module to the base LLVM Module as well as the ability to
retrieve a reference to them when the are present. This reference
retrieval was mistakenly used to determine if the module was
present in spite of the fact that references are never null. Worse
the reference is from a dereferenced pointer, so if it wasn't there,
it would cause a null dereference. The module interface had methods
to query the presence of these submodules, but they weren't used.
fixes 4 clang warnings and possibly some mysterious crashes

The same warning for a different cause is encountered where an
address is taken of a value passed by reference and compared to
null, which can never be true.
Fixes 1 clang warning.
2018-06-05 13:54:01 -04:00
Chas. Boyd 04d656105a
Update README.md 2018-06-04 13:21:14 -07:00
Greg Roth f8fa9c92a0 [linux-port] disable covered-switch-default warning (#1332)
Defaults in switch statments can mask warnings that might
indicate that a new enum value was added and corresponding changes
to a switch statement that relies on that enum are missed. For this
reason, clang reports when switch statements that fully define case
statements for all possible enum values contain default: statements.

However, this is a warning of a potential problem that might arise
from future changes to the code rather than anything that might be
wrong now. Additionally, while unlikely that an enum switch might
be presented with a value that isn't valid for that enum, it isn't
impossible. So rather than respect this warning, we will silence it.
It's not included by default. LLVM wanted it. We don't, so it's
removed. This makes the earlier external cmake change unnecessary.
Ignores 34 clang warnings
2018-06-04 05:53:02 +08:00
Greg Roth a6f857371d [linux-port] Unused variables in conditionals (#1336)
A surprising number of if statements declare variables in their
parentheses. Usually, these variables are used afterward. When they
are not, gcc produces a warning. clang does not.
Fixes gcc warnings.
2018-06-02 11:23:51 -04:00
Greg Roth d975f150b7 [linux-port] Correct conditional groupings (#1326)
Clang and gcc complain when AND and OR logical operations are both
used in a single conditional because of the possibility of mistakes
when depending solely on operator precedence. In fact, this change
fixes a few clear errors mostly in asserts that would never fire.
Fixes 13 clang and 22 gcc warnings.

Additionally, when two if statements are followed by an else, there
may be some ambiguity in terms of which if the else applies to. It
is the closest one, the second in the case of two, but it is another
area of potential mistakes. Adding braces around the code intended
as the block of the first if conditional clarifies this.
fixed 8 clang and 8 gcc warnings.

Clang complains sometimes when assignments take place in a
conditional without additional parenthesis around it. It can
indicate when what was meant to be an equal comparison is replaced
with an assignment.
fixes 2 clang warnings.
2018-06-02 04:19:14 -04:00
Greg Roth 4aa0f706c8 [linux-port] Fix spirv test warnings (#1337)
clang-spirv-tests uses a lot of external projects that keep
themselves clean with different standards of warnings flags.
This alters the appropriate cmake files to disable flags that
the DXC build enables.
Fixes 72 gcc and 166 clang warnings.

Additionally catch some sign mismatch comparisons in tests
built as part of clang-spirv-tests.
Fixes 2 gcc and 2 clang warnings, but one of them has multiple sources
So it's kind of a lot more.
2018-06-02 04:16:29 -04:00
Greg Roth c8184d216c [linux-port] Dummy access to unused variables (#1325)
Simply including a variable as the entirity of an expression is
insufficient to silence warnings for gcc and clang. The variable
is not reported as unused, which is the intent, but the expression
result is reported in a warning as unused. By casting that
expression as (void), both warnings are silenced.
Fixes 110 clang and 40 gcc warnings.
2018-06-01 19:44:16 -04:00
Greg Roth 92f7997a9d [linux-port] Remove/dummy unused class components (#1333)
Clang is smart enough to detect when a class member function or
variable is not used and emits a warning for that case. This
removes all such members as well as any corresponding parameters
and other variables that might have been used to initialize such.
Fixes 8 clang warnings.

NotOptimized in DxilGenerationPass echoed in places that made us
think that it might be needed at some point in spite of not being
used now. So it gets a dummy reference instead of being removed.
2018-06-01 19:41:57 -04:00
Ehsan fb581f6228
[spirv] Update SPIR-V Tools. (#1334) 2018-06-01 12:45:40 -04:00
Greg Roth 0987e48b56 [linux-port] Fix DXASSERT warnings (#1322)
The various DXASSERT macros produced a number of different warnings.
The most obvious was providing an empty string for a macro expecting
a message. Substituting in the _NOMSG macro fixes this.
Fixes 13 clang warnings.

A trickier problem for GCC and Clang is a variadic macro that is
provided no variadic arguments. Both Clang and GCC will avoid
errors by using the ##__VA_ARGS__ non-standard behavior, but it's
not an ideal solution. It turns out there aren't that many DXASSERT
macros that actually take variadic arguments. So I added an _ARGS
variant and replaced those instances with that. An ancillary benefit
is that non variadic asserts can present a message with the assert.
Fixes 583 clang warnings and 582 gcc warnings.

In what I expect was an earlier attempt to overload the DXASSERT
macro, it was defined twice each time with a different number of args.
Sadly, macros can't be overloaded, so this just produced more errors.
Fixes 69 clang warnings and 69 gcc warnings.

Finally, I removed the user declaration of std::error_code because
it is defined in a standard header <system_error>. Because clang was
including that header some places, it saw it as a redefinition. But
the Linux version is a struct and windows is a class. So nothing we
put here can make everyone happy. It doesn't really fit with this
change except for in proximity but doesn't fit anywhere else either.
Fixes 52 clang warnings
2018-05-31 15:27:06 -04:00
Greg Roth 68185161a2 [linux-port] Fix warnings from lambda functions (#1320)
Various lambda functions included captured variables that they
didn't actually use. This produces a warning on clang.
Fixes 6 clang warnings.
2018-05-31 13:39:26 -04:00
Greg Roth 8ccd639869 [linux-port] Fix anonymous struct warnings (#1329)
A most pervasive warning from a minimal amount of code. The Wintypes
header included an anonymous struct in the form of LARGE_INTEGER
which is specified by Microsoft, but the actual MS header includes
another struct in the union for environments that don't want
anonymous structs. Given the minimal usage, I think this can
qualify. Microsoft's own headers will exclude the anonymous struct
in favor of the named one if NONAMELESSSTRUCT is defined before
windows.h. To prevent future uses of the anonymous part of LARGE_
INTEGER, this defines that in WinIncludes.h.
Fixes 148 clang and 148 gcc warnings.
2018-05-31 13:27:55 -04:00
Young Kim 655bc9692f
use prettyxml to generate ShaderOpArithTable.xml (#1192) 2018-05-30 14:31:37 -07:00
Greg Roth 1fafc7bc77 [linux-port] Correct const casts (#1324)
There are a lot of cases where const is carelessly cast off. Some
of them lead to really dramatic changes in multiple interfaces to
fix properly. This is instead a subset of cases where const was
disrespected, often for no apparent reason at all. likely just a
mistake in type casting.

Fixes 88 gcc and 88 clang warnings.
2018-05-30 16:14:59 -04:00
Greg Roth 57f1909f5d [linux-port] Fix preprocessor warnings (#1323)
Remove pragma once from source files. It has no meaning in a source
file unless it's used as a header, which, fortunately, none of
these are.
Fixes 3 clang and 3 gcc warnings.

Remove trailing tokens after #endifs. Common result from copy,
paste, and slightly alter the beginning #if line to keep the
comments after consistent.
Fixes 3 clang and 3 gcc warnings.
2018-05-30 12:50:46 -04:00
Greg Roth 5267dff556 [linux-port] Mark all overridden methods (#1319)
Clang produces a warning when a method that overrides another is
not marked with the override keyword. Adding the keyword has no
effect on overridden functions, but it is good practice to mark
all methods intended to override as such because if they fail to
do so, the keyword will produce an error.

Fixes 78 Clang warnings.
2018-05-30 09:07:16 -04:00
Greg Roth df8f1cb289 [linux-port] Scalar initialization warnings (#1316)
There is the possibility of a few variables being used without
initialization, which causes some warnings.
Fixes 2 clang warnings

GCC worries that assigning a variable to the result of an
assignment of that same variable may be undefined. It's a silly
thing to do anyway. So it's removed.
Fixes 1 gcc warning.

GCC is quite sure that Interp is too small to hold values of up
to 9 with only 4 bits. Perhaps because the RHS is a variable of
8 bits.
Fixes 47 gcc warnings
2018-05-30 08:51:05 -04:00
Greg Roth 7a87a51ac9 [linux-port] Remove extra semicolons (#1317)
Terminating classes may create a muscle memory for typing a
semicolon after a left-justified closed brace. Whatever the reason
to GCC's chagrine there were many functions ended with unnecessary
semicolons. Each one caused a warning. This removes them.

Fixes 285 GCC warnings
2018-05-30 06:36:14 -04:00
Greg Roth 6ddc8622d9 [linux-port] More compile improvement (helps GCC). (#1310)
GCC has what seems to me to be a bug where it disapproves of the members
of a member struct of class OP having the same name as a type imported
by "using". It's the only compiler with the issue and I don't see any real
conflict, but it's easier to placate it than to fix GCC. GCC
claims its ambiguous. Making the member variables lowercase fixes
this neatly.

Removed some PointerStatus:: prefixes from references within the
class itself which upsets GCC.

HLSL changes excluded Transforms/Instrumentation directory entirely
including BoundsChecking. However it didn't excluder one reference
to a function declared there in BackendUtil that fails to link on GCC.
The function that references the missing BoundsChecking function
is static and not used anywhere with current settings. So it's not
considered a symbol to be linked by MSVC or clang, but GCC insists.
2018-05-29 15:29:47 -04:00
Ehsan 37c35f2f6e
[linux-port] Update CMake files. prepare for Linux. (#1312)
This CL makes changes to CMake files in order to:
1- disable things that are not supported on non-Windows platforms.
2- make cross-platform compilation possible.

It also brings back LLVM's config.guess (mirrors:
https://github.com/llvm-mirror/llvm/blob/master/cmake/config.guess)
2018-05-29 15:19:37 -04:00
Ehsan f28b030c74
[spirv] None (0x0) is an invalid Image Operand. (#1311) 2018-05-28 11:56:36 -04:00
Greg Roth 7ad425a495 [linux-port] Use llvm::sys::Atomic* (#1309)
InterlockedIncrement and InterlockedDecrement are atomic operations to
increment or decrement the value pointed to by the pointer parameter and
return the same.

There are already platform abstractions available to LLVM in Atomics.h.
This change leverages them to implement the same functionality in a
platform-agnostic way. Mostly it's just a matter of swapping
InterlockedIncrement for AtomicIncrement.
2018-05-24 18:04:50 -04:00
Greg Roth 772f1af14d [linux-port] Compile improvements (helps gcc). (#1307)
GCC5 has a few limitations that later versions do not. The
most pervasive issue is the confusion of scoped operators on enum
names when the name of the enum is shared with a local variable.

The only other issue concerns intialization of a union containing
structs and how many curly braces is enough.
2018-05-24 16:32:06 -04:00
Vishal Sharma 82eb3de7b9
Merge pull request #1305 from vcsharma/update-build-config
Enable pdb generation for exes in release mode
2018-05-23 18:25:57 -07:00
Vishal C Sharma 6e3ece5ee8 Update global cmake exe linker flag to emit pdbs in release mode 2018-05-23 17:07:14 -07:00
Vishal C Sharma c388be01e0 Enable pdb generation for dxc and dxopt in non-debug modes 2018-05-23 15:37:45 -07:00
Lei Zhang 24dcc8c8bc
[spirv] Update external projects (#1303) 2018-05-23 15:23:17 -04:00
Tex Riddell 6a7f99cf5f
Update NVIDIA driver status text in README.md 2018-05-22 20:20:04 -07:00
Greg Roth 6f8c457799 [linux-port] Fix DiagnosticPrinter use of std::hex (#1298)
DiagnosticPrinter doesn't support io manipulators like std::hex,
in spite of that, they were included in some invocations of it. MSVC
seemed to allow this because it interpretted std::hex as a void
pointer, which is supported.

This adds support of std::hex and similar manipulators by adding an
overloaded operator<< that takes the type of std::hex and its friends
and sets a base number which is used when the base is not 10 to print
numbers in the specified base, which can only be 8 or 16 according to
what is passed in.

Also while I was changing things in raw_ostream.h I added a
missing override keyword that produced a lot of warnings on clang.
2018-05-22 11:19:28 -04:00
Greg Roth 18610e744c [linux-port] Fix a handful of warnings in headers (#1299)
Just a few warning conditions in a handful of common headers
was producing pages and pages of warning messages. By fixing them,
the output spew is reduced significantly.

Static variables in a header produce a separate variable for every
file that includes it. In many of these, these variables were unused.
Instead, variables used in multiple files should be defined only
once in a source file and declared as extern in the header.

Many unsigned variables were checked to be greater than zero and less
than 3 in HlslTypes.h. If they were somehow assigned a negative
value, it would appear as much greater than 3 in unsigned form.
So we can just check that they are less than or equal to 3.

In Type.h, parammods_begin() was casting its return value to the
proper pointer, but without const, producing an error. The best
part is that the function returned a const pointer. The cast was
just wrong. Adding const silences the warning.
2018-05-18 14:13:55 -04:00
Ehsan 090d3680f9
Fix cmake for non-appveyor buildbot environments. (#1297) 2018-05-18 10:50:33 -04:00
Lei Zhang b17ed7f06d
[spirv] Avoid creating temporary variables for local variables (#1293)
When calling functions with arguments that references local
variables as a whole and annotated with out/inout, we don't
need to create temporary variables for them again. Just pass
the pointers to the original local variables.
2018-05-18 09:51:07 -04:00
Lei Zhang 83de7d31ce
[appveyor] Package more build artifacts (#1294)
Added header files, *.lib files, and *.pdb files.
2018-05-18 07:55:28 -04:00
Ehsan 72ae7c6577
[linux-port] Define LLVMBuild.txt for DxcSupport. (#1292)
Also add missing dependencies for lib/HLSL.

These dependencies only manifest themselves in Debug mode.
2018-05-17 22:55:54 -04:00
Ehsan 5b06474545
[spirv] Fix function parameter evaluation order. (#1296) 2018-05-17 22:55:30 -04:00
Lei Zhang 4260d00a17
[appveyor] Disable CompileWhenNoMemThenOOM (#1295)
Suddenly the CompileWhenNoMemThenOOM test started to fail
on Appveyor even for a pull request that is trivial and does not
touch the source code. And we cannot reproduce this failure locally.
It's likely an Appveyor infrastructure issue; they updated a few things
yesterday.

I temporary disabled this test on Appveyor CI for now to unblock
other work. A following up PR to try to revert this PR and fix the issue.
2018-05-17 16:34:28 -04:00
Lei Zhang d849dc2b86
[spirv] Support ViewportIndex & Layer in VS and DS (#1290)
Using SV_RenderTargetArrayIndex (translated into Layer builtin)
and SV_ViewportArrayIndex (translated into ViewportIndex builtin)
in VS and DS output requires the SPV_EXT_shader_viewport_index_layer
extension.
2018-05-16 15:01:46 -04:00