Compare commits

...
7 Commits
Author SHA1 Message Date
Larry Gritz f4db549061 runner
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-10 22:40:36 -07:00
Larry Gritz 4debd96adc Set up workflows to have subsequent PR pushes cancel previous in-progress jobs
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-10 22:30:58 -07:00
Larry Gritz 30a4a95b7e Experiment: use new big runner to speed up the expensive analysis run
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-10 22:18:46 -07:00
Larry Gritz a38aa58c0e typo
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-10 22:08:46 -07:00
Larry Gritz e126a20df7 Analysis build for avx512 as well for more code coverage
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-10 22:05:08 -07:00
Larry Gritz 52cf2ee418 Improve testing coverage
Looking at the code coverage report and trying to get a higher
coverage amount, employing two strategies: (a) remove unused code
that is not covered because it's... unused; and (b) test things
that are used but aren't in the test run. Details follow.

Arbitrarily pick a couple of render tests to use llvm_opt levels 12
and 13 to verify that they work correctly. (That's a couple hundred
lines of pass setup code that wouldn't otherwise be included in the
coverage analysis, nor tested in the testsuite.) This also required us
to add the --llvm_opt command to testrender, as it is in testshade.

Remove deprecated version of LLVM_Util::make_function.

When OSL_USE_OPTIX is not enabled, exclude compiling contents of
ptx_compile_group.

get_alignment can also be OSL_DEV only as well as simplified

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-10 21:54:57 -07:00
Larry Gritz 83a1e7e74b WIP: improve coverage analysis
Disable contents of dump_struct_data_layout when OSL_DEV is not
defined, it will never be called in any other circumstances -- it's
strictly a debugging tool, not part of the shipping library.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2022-10-10 18:06:54 -07:00
8 changed files with 51 additions and 48 deletions
+10 -3
View File
@@ -19,6 +19,11 @@ on:
permissions: read-all
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
@@ -30,9 +35,10 @@ jobs:
fail-fast: false
matrix:
include:
- desc: sonary gcc9/C++14 llvm13 py3.9 boost1.76 exr3.1 oiio2.3 avx2
- desc: sonar gcc9/C++14 llvm13 py3.9 boost1.76 exr3.1 oiio2.3 avx2
nametag: static-analysis-sonar
os: ubuntu-latest
os: ubuntu-20.04-8c-32g-300h
# os: ubuntu-latest
vfxyear: 2022
vfxsuffix: -clang13
cxx_std: 14
@@ -40,7 +46,7 @@ jobs:
python_ver: 3.9
pybind11_ver: v2.9.0
simd: avx2,f16c
batched: b8_AVX2
batched: b8_AVX2,b16_AVX512
coverage: 1
# skip_tests: 1
sonar: 1
@@ -71,6 +77,7 @@ jobs:
PYTHON_VERSION: ${{matrix.python_ver}}
USE_BATCHED: ${{matrix.batched}}
USE_SIMD: ${{matrix.simd}}
PARALLEL: 24
# DEBUG_CI: 1
steps:
# We would like to use harden-runner, but it flags too many false
+5
View File
@@ -25,6 +25,11 @@ on:
permissions: read-all
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
+1
View File
@@ -61,6 +61,7 @@ echo "uname -a: " `uname -a`
echo "uname -m: " `uname -m`
echo "uname -s: " `uname -s`
echo "uname -n: " `uname -n`
echo "nproc " `nproc`
pwd
ls
env | sort
-9
View File
@@ -154,15 +154,6 @@ public:
void debug_pop_inlined_function();
void debug_set_location(OIIO::ustring sourcefile, int sourceline);
/// Create a new function (that will later be populated with
/// instructions) with up to 4 args.
OSL_DEPRECATED("Use make_function flavor that takes a cspan (1.12)")
llvm::Function* make_function(const std::string& name, bool fastcall,
llvm::Type* rettype, llvm::Type* arg1 = NULL,
llvm::Type* arg2 = NULL,
llvm::Type* arg3 = NULL,
llvm::Type* arg4 = NULL);
/// Create a new function (that will later be populated with
/// instructions) with a cspan of args.
llvm::Function* make_function(const std::string& name, bool fastcall,
+17 -34
View File
@@ -1589,29 +1589,26 @@ LLVM_Util::make_jit_execengine(std::string* err, TargetISA requestedISA,
namespace /*anonymous*/ {
#ifdef OSL_DEV
// The return value of llvm::StructLayout::getAlignment()
// changed from an int to llvm::Align, hide with accessor function
#if OSL_LLVM_VERSION < 100
uint64_t
inline uint64_t
get_alignment(const llvm::StructLayout* layout)
{
# if OSL_LLVM_VERSION < 100
return layout->getAlignment();
}
#else
uint64_t
get_alignment(const llvm::StructLayout* layout)
{
# else
return layout->getAlignment().value();
# endif
}
#endif
} // namespace
void
LLVM_Util::dump_struct_data_layout(llvm::Type* Ty)
LLVM_Util::dump_struct_data_layout(llvm::Type* Ty OSL_MAYBE_UNUSED)
{
#ifdef OSL_DEV
OSL_ASSERT(Ty);
OSL_ASSERT(Ty->isStructTy());
@@ -1635,6 +1632,7 @@ LLVM_Util::dump_struct_data_layout(llvm::Type* Ty)
}
std::cout << std::endl;
}
#endif
}
@@ -2449,25 +2447,6 @@ LLVM_Util::internalize_module_functions(
llvm::Function*
LLVM_Util::make_function(const std::string& name, bool fastcall,
llvm::Type* rettype, llvm::Type* arg1,
llvm::Type* arg2, llvm::Type* arg3, llvm::Type* arg4)
{
std::vector<llvm::Type*> argtypes;
if (arg1)
argtypes.emplace_back(arg1);
if (arg2)
argtypes.emplace_back(arg2);
if (arg3)
argtypes.emplace_back(arg3);
if (arg4)
argtypes.emplace_back(arg4);
return make_function(name, fastcall, rettype, argtypes, false);
}
llvm::Function*
LLVM_Util::make_function(const std::string& name, bool fastcall,
llvm::Type* rettype, cspan<llvm::Type*> params,
@@ -5831,6 +5810,7 @@ bool
LLVM_Util::ptx_compile_group(llvm::Module* lib_module, const std::string& name,
std::string& out)
{
#ifdef OSL_USE_OPTIX
std::string target_triple = module()->getTargetTriple();
OSL_ASSERT(
@@ -5874,9 +5854,9 @@ LLVM_Util::ptx_compile_group(llvm::Module* lib_module, const std::string& name,
options.AllowFPOpFusion = llvm::FPOpFusion::Fast;
options.NoZerosInBSS = 0;
options.GuaranteedTailCallOpt = 0;
#if OSL_LLVM_VERSION < 120
# if OSL_LLVM_VERSION < 120
options.StackAlignmentOverride = 0;
#endif
# endif
options.UseInitArray = 0;
llvm::TargetMachine* target_machine = llvm_target->createTargetMachine(
@@ -5908,15 +5888,15 @@ LLVM_Util::ptx_compile_group(llvm::Module* lib_module, const std::string& name,
llvm::raw_svector_ostream assembly_stream(assembly);
// TODO: Make sure rounding modes, etc., are set correctly
#if OSL_LLVM_VERSION >= 100
# if OSL_LLVM_VERSION >= 100
target_machine->addPassesToEmitFile(mod_pm, assembly_stream,
nullptr, // FIXME: Correct?
llvm::CGFT_AssemblyFile);
#else
# else
target_machine->addPassesToEmitFile(mod_pm, assembly_stream,
nullptr, // FIXME: Correct?
llvm::TargetMachine::CGFT_AssemblyFile);
#endif
# endif
// Run the optimization passes on the functions
fn_pm.doInitialization();
@@ -5942,6 +5922,9 @@ LLVM_Util::ptx_compile_group(llvm::Module* lib_module, const std::string& name,
delete linked_module;
return true;
#else
return false;
#endif
}
+12
View File
@@ -42,6 +42,7 @@ static bool saveptx = false;
static bool warmup = false;
static bool profile = false;
static bool O0 = false, O1 = false, O2 = false;
static int llvm_opt = 1; // LLVM optimization level
static bool debugnan = false;
static bool debug_uninit = false;
static bool userdata_isconnected = false;
@@ -76,6 +77,15 @@ set_shadingsys_options()
if (const char* opt_env = getenv("TESTSHADE_OPT")) // overrides opt
opt = atoi(opt_env);
shadingsys->attribute("optimize", opt);
// The cost of more optimization passes usually pays for itself by
// reducing the number of instructions JIT ultimately has to lower to
// the target ISA.
if (const char* llvm_opt_env = getenv(
"TESTSHADE_LLVM_OPT")) // overrides llvm_opt
llvm_opt = atoi(llvm_opt_env);
shadingsys->attribute("llvm_optimize", llvm_opt);
shadingsys->attribute("profile", int(profile));
shadingsys->attribute("lockgeom", 1);
shadingsys->attribute("debug_nan", debugnan);
@@ -149,6 +159,8 @@ getargs(int argc, const char* argv[])
.help("Do a little runtime shader optimization");
ap.arg("-O2", &O2)
.help("Do lots of runtime shader optimization");
ap.arg("--llvm_opt %d:LEVEL", &llvm_opt)
.help("LLVM JIT optimization level");
ap.arg("--debugnan", &debugnan)
.help("Turn on 'debugnan' mode");
ap.arg("--path SEARCHPATH", &shaderpath)
+3 -1
View File
@@ -5,4 +5,6 @@
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
outputs = [ "out.exr" ]
command = testrender("-r 256 256 -aa 4 bumptest.xml out.exr")
command = testrender("-r 256 256 -aa 4 --llvm_opt 13 bumptest.xml out.exr")
# Note: we pick this test arbitrarily as the one to verify llvm_opt=13 works
+3 -1
View File
@@ -7,4 +7,6 @@
failthresh = 0.01
failpercent = 1
outputs = [ "out.exr" ]
command = testrender("-r 256 256 -aa 4 cornell.xml out.exr")
command = testrender("-r 256 256 -aa 4 --llvm_opt 12 cornell.xml out.exr")
# Note: we pick this test arbitrarily as the one to verify llvm_opt=12 works