XIO

xWire

Posts from every feed QUEST has found across the web — blogs, news, podcasts, channels and more.

LLVM Discussion Forums - Latest posts

Latest posts

[RFC][clang-tidy] Organize lit tests into per-check directories

Thank you for the RFC! I don’t have strong opinions on the topic currently. My initial inclination is that the status quo is reasonable – yes, you may end up running more tests locally while making changes to a particular check, but you still have to run all the tests locally before pushing the patch anyway so it feels like the benefits don’t really justify the churn to the test hierarchy. However, that’s not a strongly held opinion. One concern I have would be impacts on downstreams with their…

[LoopIdiom] Should loop-idiom skip memcpy formation when the trip count has upperbound?

The relevant recent work (merged on main) is: https://github.com/llvm/llvm-project/pull/226801 [LoopIdiom] Add a range attribute to formed memset/memcpy/memmove It should be [32, 33) instead of [0, 33). Right, and for a one-legal-value range, we should just straight up replace the dynamic size with the constant.

[LoopIdiom] Should loop-idiom skip memcpy formation when the trip count has upperbound?

The problem with recognizing a loop as mem{cpy,set,move} is that the pass that unrolls a loop and the pass that inlines/expands a mem{cpy,set,move} are different (and for the latter, we actually do it in a few different passes, which I think is a problem), they run at different phases, do different checks etc. Which is a bit unfortunate because you’d expect loop idiom recognition to not prevent anything, you still have the same information as the original loop just in a more concise IR. But…

Bytecode compatibility guarantees for the Func dialect?

Thanks and apologies for the delayed response - catching up after a long weekend. Here are some initial thoughts which I hope to elaborate further in an RFC. For the func dialect operations my thinking is to maintain compatibility similar to builtin (newer readers accept historical artifacts, and newer writers target older readers where representable). Changes that break compatibility would require a dialect version increment and compatibility logic. In practise this means most changes to the…

[RFC] Linear Type System Support in Upstream MLIR

FedericoBruzzone: Could you elaborate a bit here? What exactly do you mean by verifier in this context? If you’re referring to the IR Verifier, I believe it doesn’t respect the principle of locality (don’t traverse use-def chains), see Developer Guide - MLIR. If you mean a separate analysis pass, then we’d be free to implement it as we like. Oh, yeah. Sorry! Exactly, I think the verifier could be an analysis pass - at least that’s how we currently do it. Given MLIR’s infrastructure, maybe…

[LoopIdiom] Should loop-idiom skip memcpy formation when the trip count has upperbound?

Hi all, I came across an interaction between loop-idiom and loop-unroll that I’d like some feedback on. Given this IR, where llvm.assume constrains the trip count has a upperbound. declare void @llvm.assume(i1) define void @assume_with_eq(ptr noalias %dst, ptr noalias %src, i32 %sz) { for.body.preheader: %cond = icmp eq i32 %sz, 8 tail call void @llvm.assume(i1 %cond) br label %for.body for.body: %i.04 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ] %dst.addr.03 = phi ptr […

[RFC] Linear Type System Support in Upstream MLIR

Hi @matthias, thank you! matthias: As little as possible: on its own, the trait only states that values of this type cannot be implicitly copied or dropped, i.e. it marks a move-only resource. Everything else is layered on top and stays semantics-independent in the sense that the verifier needs no dialect-specific knowledge. The verifier then enforces the constraints of the trait. Could you elaborate a bit here? What exactly do you mean by verifier in this context? If you’re referring to the IR…

[RFC][mlir][Linalg][Vector] Fast-math flags on Linalg and Vector ops

banach-space: IMO it shouldn’t - unless somebody presents an argument for having such a flexibility (I mean contract and reassoc flags exclusively). In the cases where the flags are missing we should require the users to explicitly set them before specialising. That’s unfortunately the cost of having a more explicit design around fastmath banach-space: FedericoBruzzone: If reassociation and FMA contraction are part of Linalg’s semantics, shouldn’t a generic operation already include such…

[RFC] Multi-level line table support in LLVM

My first question would be, if the IRLayers are being preserved through hoists because that’s more useful for profiling, is it also the case that regular line/column numbers should be preserved through hoists for profiling as well? If that is the case, I feel the important question isn’t around IR layers directly, but around how to represent this desire for profilers. Personally, I see no issue with adding an LLVM flag that enables preserving debug info through control-flow-breaking operations,…

[RFC] Universal CFI

and the default PAC behavior treats all indirect calls as equivalent Sorry to be a pain. PAC is used by more than one protection scheme and I wanted to know which one? There’s pac-ret which is from -mbranch-protection=standard (or pac-ret) which covers the return address only. There’s also the arm64e (Apple) and PAuthTest (ELF) that also covers indirect calls. C function pointers do not use type discrimination by default as I believe that causes problems with some permitted C casting. C++…

[RFC][Draft] P2300R10 std::execution Initial design drafts

@Emmett Here are my drafts. We have three problems: We need Clang frontend support for constexpr expressions. We need Clang frontend support for awaiter lookup for libraries. We need the C++26 additions to <stop_token>. These three are prerequisites for the std::execution work not described under exec*. After that, we can proceed in the following order: Vocabulary Core Core additions Primitive algorithms Composed algorithms Large components (coro task, parallel scheduler) Realistically, we can…

[RFC] Universal CFI

kbeyls: I wanted to make sure I understood this correctly. “lower precision”: is that because fewer hash bits may be used in the hardware based forward-edge CFI schemes compared to the kcfi scheme; or something different? Most hw forward edge protection doesn’t use any meaningful bits AFAIK. CET doesn’t, and the default PAC behavior treats all indirect calls as equivalent. I know there are some interesting hw extensions to PAC that increase the inputs to any hash, but not aware of those being…

[RFC] Universal CFI

I’m excited to see a drive towards use of control-flow integrity in wider set of deployed binaries! We have also looked carefully at exclusively leveraging hardware based forward-edge CFI, but it provides dramatically lower precision than we can achieve in software, and we can make the forward-edge software implementation fast enough to deploy universally. I wanted to make sure I understood this correctly. “lower precision”: is that because fewer hash bits may be used in the hardware based…

[RFC] AI Policy strengthening around explainability

artagnon: Hehe, in math academia I think fundamentally this might be where I feel you’re going wrong: you’re trying to use mathematical formal construction and translating that into natural language. That isn’t really how (most) humans work. OTOH, I’m not a psychology professional, so I’m not able to provide you with the “best” way of communicating with people

[RFC] Linear Type System Support in Upstream MLIR

Many thanks for the pointers! What exactly should it guarantee, and how much of that guarantee can realistically be expressed independently of the surrounding IR semantics? As little as possible: on its own, the trait only states that values of this type cannot be implicitly copied or dropped, i.e. it marks a move-only resource. Everything else is layered on top and stays semantics-independent in the sense that the verifier needs no dialect-specific knowledge. The verifier then enforces the…

[RFC][AMDGPU] Deprecating and removing LLVM’s R600/TeraScale backend

Sorry for the delayed response. Thanks @YuxinHao I am running some AI code on these gpus: R600, RV670, R700, Evergreen, Northern Islands. Where the shaders are compiled via LLVM and run through pixel shaders using Mesa. What do you suggest I should do if the deprecation goes through? I am sure there are people using these gpus out there that require compiler support. Should we pin to current LLVM release forever? If there are fixes, what is the plan? As Matt mentioned, is it less effort to…

[RFC] Compiler-driven CPU dispatch for x86: -fauto-target-clones=

## Summary We propose a Clang option that does function multi-versioning automatically: ``` clang -O2 -fauto-target-clones=x86-64-v3,novalake app.c ``` The compiler selects the functions where specialized code is likely to pay off, compiles each of them for the normal baseline and once more for each requested target (an ISA level or a CPU), and adds a run-time dispatcher. The binary still runs on every CPU the baseline supports, and uses the specialized code on CPUs that have the target’s…

[RFC] Linear Type System Support in Upstream MLIR

Thanks for the detailed feedback! Quantum computing nowadays also uses classical constructs, so this is a very relevant question! We faced the same problems when implementing linear typing for structured control flow and ended up with a custom if (and index_switch) op to enforce static linear typing: %q1 = qpu.if %condition args(%arg0 = %q0) -> (!qpu.qubit) { ^bb0(%arg0: !qpu.qubit): %q1 = qpu.h %arg0 : !qpu.qubit qpu.yield %q1 : !qpu.qubit } else args(%arg0 = %q0) { ^bb0(%arg0: !qpu.qubit):…

[RFC] Universal CFI

pinskia: One suggestion is to move away from the current kcfi hashing function. It does not work for many c compatibility functions. There has to have some better way of doing the hashing than using the mangled c++ like name. Iterating on the hashing is definitely in-scope here. I think we’ll have some PRs in this space, but happy to have more ideas to tighten and harden hash-based CFI and PRs in that direction. We specifically mention extending the cfi_salt in the RFC, and I’m guessing there…

[RFC] Universal CFI

chandlerc: Virtual functions are called indirectly only through vtables rather than ordinary function pointers, so virtual calls use a separate hash domain. That is not fully true. Pointer to member functions can call virtual functions. And in some cases pointer to member functions can just be pointing to the virtual function. Unless I am missing something in the ia64 abi there. Oh and it looks like clang does not implement (even though it claims to be GNU C++ compatible) the GNU extension that…

[RFC] StoreInstCombiner for msked integer stores

I propose a StoreInstCombiner that describes integer stores using two ranges in memory. This lets us compare stores of different widths and offsets and find opportunities to combine updates, remove overwritten stores, or write fewer bytes. Access and Update Access is the full range written by the store, computed from its address and its store size in DataLayout. Update is the range of bits the store may change. To derive a smaller range, the combiner must prove that the remaining bits come from…

Seeking advice on reporting ~100 MLIR bugs found by an automated testing tool

Thanks @banach-space for tagging the thread and for looking at the reports! fuzzing-campaign sounds good to me. I’ll treat this thread as the campaign summary then. Once your template lands, I’ll file the 9 high-priority bugs with it. Your template PR looks good to me overall, I just have one small question about the title prefix (my review). @LiRvs-Miria, the flow you describe is pretty much what happened in this thread, and it worked well for me. Adding a backlink to each issue costs the…

[RFC] Declare optimization remark kinds in TableGen

Hi Michael Thanks for the feedback. Although in the proposal the remarks are now split into an API call in the code and a TableGen definition it’s not clear to me it is that much more effort. For the majority of the remarks it’s boilerplate TableGen. Current ORE: ORE->emit([&]() { return OptimizationRemark(DEBUG_TYPE, "Hoisted", &I) << "hoisting " << ore::NV("Inst", &I); }); Its def in the prototype’s OptRemarks.td: def LICMHoisted : OptRemark<"Hoisted", Passed, "hoisting %{Inst}",…

[RFC] Universal CFI

Summary We (Google) are working to make CFI something that can be deployed significantly more easily and at a larger scale than it has been until now. This includes: Building on the kCFI model of hash-based enforcement Expanding it to virtual functions and vtables in C++ Adding source annotations (or other techniques) to narrow the sets of valid CFI targets Exploring ways to use the same techniques for backward-edge CFI when we don’t have hardware support available (PAC or CET) Improving the…