Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[BUG] Assert in llvm_util.cpp validate_struct_data_layout using batched mode and LLVM 21.1.x

Aperta
#2,111 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
cpp
Ambito
compilers

Direzione di ricerca

Inizia in src/liboslexec/llvm_util.cpp, in validate_struct_data_layout, e riproduci l’assertion con la modalità batched, OIIO 2.5.18.0, LLVM 21.1.x e lo shader segnalato. Confronta il comportamento del layout della struct con LLVM 19.1.7 e analizza gli offset previsti rispetto a quelli effettivi; il lavoro è completato quando la configurazione segnalata non genera più un’assertion, mentre la validazione del layout rimane corretta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Note: The prompts below are just to help you formulate a good and actionable
request. Feel free to deviate from this format or to delete this text and
write free-form if you prefer.

Describe the bug

When using OSL in batched mode eg. in GafferOSL's OSLObject, an assertion happens in validate_struct_data_layout:
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/b3c601f291a9fedf4c43f311fe7224c3b2d073ea/src/liboslexec/llvm_util.cpp#L1797

I saw the OSL_DEV definition is one mechanism to print out the values and see where it differs which I tried, however I ran into an issue where TextureOpt's envlayout is now private so that codepath doesn't quite work anymore without modification (and risk not getting the right information to debug the original issue...)

OSL version and dependencies

  • OSL branch/version: tagged 1.14.8.0 and 1.14.10.0 tested
  • OS: Windows 11
  • C++ compiler: MSVC 14.44 (v143 toolkit with -D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
  • LLVM version: 21.1.3 and 21.1.8 tested (not an issue with 19.1.7)
  • OIIO version: 2.5.18.0
  • Architecture: x86_64 Ryzen 7 6800M CPU (Zen3) so most likely using AVX2 in batched mode.

To Reproduce

Steps to reproduce the behavior:

  1. On Windows it is the combination of OIIO 2.5.18.0, LLVM 21.1.3, OSL 1.14.10.0
  2. For OSL it is built with: USE_BATCHED="b8_AVX,b8_AVX2,b8_AVX2_noFMA,b8_AVX512,b8_AVX512_noFMA,b16_AVX512,b16_AVX512_noFMA" (default for Gaffer builds on Linux, not on Windows yet)
  3. Create a basic OSLObject or something that uses batched mode.
  4. Assert! In validate_struct_data_layout call of liboslexec/llvm_util.cpp

Evidence

C:\dev\rpks\osl\1.14.10.0\build\osl\src\liboslexec\llvm_util.cpp:1797: void __cdecl OSL::v1_14::pvt::LLVM_Util::validate_struct_data_layout(class llvm::Type *,const class std::vector<unsigned int,class std::allocator<unsigned int> > &): Assertion 'expected_offset_by_index[index] == actual_offset' failed.
int i;
getattribute( "shading:index", i );

output1 = 0.1 * hashnoise( i );

IF YOU ALREADY HAVE A CODE FIX: Not yet but this is a fairly obscure combination mix that I don't expect someone else to reproduce easily, so I'm willing to understand things better so I can help make a fix. I can also check Linux later to see if it happens there. The big suspect is an LLVM change that has been made between 19 and 21 that's not being taken into account here somewhere.

Lingua principale
C++
Stelle
2.3k
Fork
415
Merge medio
2g 14h
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AcademySoftwareFoundation/OpenShadingLanguage

Tutte le issue di AcademySoftwareFoundation/OpenShadingLanguage

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.