Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 03 22:29
    steven-johnson review_requested #7058
  • Oct 03 22:29
    steven-johnson opened #7058
  • Oct 03 22:28

    steven-johnson on wabt

    Upgrade wabt to 1.0.30 (compare)

  • Oct 03 21:30
    derek-gerstmann synchronize #6924
  • Oct 03 21:29

    derek-gerstmann on vulkan-phase2-runtime

    Whitespace change to trigger bu… (compare)

  • Oct 03 20:46
    steven-johnson commented #7057
  • Oct 03 20:44
    slomp commented #7057
  • Oct 03 20:17
    alexreinking commented #7057
  • Oct 03 20:07
    slomp commented #7057
  • Oct 03 19:08
    derek-gerstmann synchronize #6924
  • Oct 03 19:08

    derek-gerstmann on vulkan-phase2-runtime

    Fix PyExt error handling (#7042… add_requirement() maintenance (… Fix false positive use after fr… and 6 more (compare)

  • Oct 03 19:00
    derek-gerstmann commented #6924
  • Oct 03 18:43
    steven-johnson commented #6924
  • Oct 03 18:27

    rootjalex on trs-codegen

    update app Makefiles (compare)

  • Oct 03 18:20
    steven-johnson commented #7056
  • Oct 03 18:17
    steven-johnson closed #7055
  • Oct 03 18:17
    steven-johnson commented #7055
  • Oct 03 18:08
    steven-johnson closed #7033
  • Oct 03 14:35
    alexreinking synchronize #6938
  • Oct 03 14:35

    alexreinking on pip

    Run each arch in parallel (compare)

Alex Reinking
@alexreinking:matrix.org
[m]
And vice versa...
Roman Lebedev
@LebedevRI
sure, that's not the question
Alex Reinking
@alexreinking:matrix.org
[m]
Okay, then where is this translation taking place?
Roman Lebedev
@LebedevRI
what i mean is, when i pass CFLAGS=-fsanitize=address, clang enables ASAN. will that just magically also enable halide's asan feature
?
Alex Reinking
@alexreinking:matrix.org
[m]
No, that's what I'm saying. It would be wrong to do that
Roman Lebedev
@LebedevRI
nono, not when compiling halide itself
e.g. when compiling halide/apps
Alex Reinking
@alexreinking:matrix.org
[m]
Clang doesn't read the CFLAGS env var AFAIK. CMake and Makefile default rules honor that variable when constructing compiler command lines.
Roman Lebedev
@LebedevRI
sure, i used env variable as an example
Alex Reinking
@alexreinking:matrix.org
[m]
I could see introducing Halide_TARGET_FEATURES as a CMake (package) variable to allow a user to add some features globally (through add_halide_library)
1 reply
-DHalide_TARGET_FEATURES=msan at the command line or set() it in a toolchain file
The sanitizers are toolchain-y anyway... that approach makes sense to me
Alex Reinking
@alexreinking:matrix.org
[m]
We should probably use some custom target properties for this... hmm. To-do.
Roman Lebedev
@LebedevRI
unless halide could directly consume CFLAGS, ask clang to interpret them, and then introspect what sanitizers/sanitizer options got enabled, i'm afraid it's not really feacible
Alex Reinking
@alexreinking:matrix.org
[m]
I'm not understanding. If you want Halide to enable a sanitizer, you add it to the list of target features. It's a downstream responsibility to configure Halide correctly, i.e. you're in control of your flags, so it's your responsibility to make sure that your various flags agree between all the compilers you're using.
Halide isn't and can't possibly be responsible for sniffing all the innumerable locations that -fsanitize might be slipped into the command lines of surrounding compiler invocations
There's CFLAGS, CXXFLAGS, hard-coded Makefile command lines, CMake's add_compile_options and target_compile_options (and abuses of related functions), compiler wrappers, etc.
Roman Lebedev
@LebedevRI
the more concrete question is: it isn't sufficient to just add ModuleSanitizerCoveragePass, it takes a number options. as i can see, in other sanitizer cases they are simply hardcoded in halide. would the suggestion be to do the same here?
Alex Reinking
@alexreinking:matrix.org
[m]
Yes, or dependent upon the other features that are enabled on the Target
E.g. if you combine multiple sanitizers
Roman Lebedev
@LebedevRI
i very much disagree that this is not halide's responsibility, it quite clearly is. the real question being, how do the knobs to configure it look like
Alex Reinking
@alexreinking:matrix.org
[m]
The Halide equivalent of a compiler command line is the Target feature set, pretty much
Roman Lebedev
@LebedevRI
that's my point actually
the unfortunate consequence of that is that each downstream will have to second-guess what clang will do, and manually tell halide do do the same
Alex Reinking
@alexreinking:matrix.org
[m]
Where is Clang involved in this?
Halide goes through LLVM for codegen, never passes through clang (unless you go through the C backend and choose to)
Roman Lebedev
@LebedevRI
perhas s/will/would/. imagine the following situation: there was some C codebase, it was being compiled with clang, with whatever sanitization flags. now, some part of that C code is replaced with AOT halide code
as far as i understand, unless explicitly enabled via halide target features, halide will not apply ASAN/MSAN, which makes sense
but the caveat is, said codebase will need some glue somewhere to toggle said halide features when the original C code would have been compiled with said sanitizers
this could look like either a cmake option in downstream code, say "WITH_ASAN", which would toggle halide feature alongside with adding -fsanitize=address to the compilation options like it did already
Alex Reinking
@alexreinking:matrix.org
[m]
if (WITH_ASAN)
  list(APPEND Halide_TARGET_FEATURES asan)
endif ()
Or in a toolchain file:
# ...
set(CMAKE_C_FLAGS_INIT "-fsanitize=memory ...")
set(HALIDE_TARGET_FEATURES "msan")
# ...
Roman Lebedev
@LebedevRI
indeed, this would be a middle-ish ground solution. the problem as i see it, the feature will not get enabled when -fsanitize=asan was specified via CFLAGS
Alex Reinking
@alexreinking:matrix.org
[m]
Yeah, I don't see that as a problem. I don't see any reason Halide should privilege CFLAGS above any other method of specification. It's not standard across all supported platforms and it's not complete on any platform. It's also likely to lead to surprising behavior in other places. No compiler that I'm aware of sniffs CFLAGS. Build systems, yes; compilers, no.
I could see maybe introducing an analogous environment variable like HLFEATURES
Roman Lebedev
@LebedevRI
and i mean that in more general sense than just parsing CFLAGS, because the bigger underlying problem is that e.g. -fsanitize=fuzzer-no-link internally enables -fsanitize-coverage=<...>
alexreinking: like in previous occurrences, by CFLAGS i don't literally mean the env variable, i mean the argument list that would have been passed to the clang/compiler
Alex Reinking
@alexreinking:matrix.org
[m]
Okay, but what if you're using GCC's coverage implementation?
We cannot be in the business of parsing third party compiler command lines
The person controlling the build is in charge of configuring their tools. Someone set -fsanitize=fuzzer-no-link. It's their responsibility to configure Halide as necessary, too. Just like if they were going to set CXXFLAGS or FFLAGS in the same project
Since CMake is our blessed build system and we prefer our AOT users to go through our helpers, adding a configuration point there makes the most sense to me.
Roman Lebedev
@LebedevRI
let me clarify: i personally would have viewed halide as an, essentially, 'alternative' clang-based front-end. is that already off-target?
Alex Reinking
@alexreinking:matrix.org
[m]
Yes, I think so. We are not clang based, we are LLVM based. If you want, you can build Halide and your generator executables on Windows, using MSVC, and produce binaries for Linux that are compatible with the toolchains there.
Roman Lebedev
@LebedevRI
hm wait, don't you at least use clang to get the initial AST?
Alex Reinking
@alexreinking:matrix.org
[m]
Nope
Roman Lebedev
@LebedevRI
aha
Alex Reinking
@alexreinking:matrix.org
[m]
We use any C++ compiler and package the compiler as a library into the resulting application. LLVM is linked in,, too.. You run that program, which produces an AST at execution time, which is passed either to MCJIT or to the usual LLVM pipeline to produce (essentially) an object file and header pair