Under FMA contraction, an item that shrinks exactly to its min-width is laid out at its flex basis
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 58/100
Línea de trabajo
Read yoga/algorithm/CalculateLayout.cpp, especially distributeFreeSpaceFirstPass and distributeFreeSpaceSecondPass, using the reproducer linked in the issue to follow the min-width boundary case. Compare the layout with floating-point contraction enabled and disabled; done means the item lays out at width 10 in both cases. Check the related issue #2038 for context on residual free space.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Report
- I have searched existing issues and this is not a duplicate
Issues and Steps to Reproduce
A row 20 wide holds an item with flexBasis: 90, flexShrink: 1 and minWidth: 10, and a sibling 10 wide that does not shrink, so the item absorbs the line's 80 of overflow and lands exactly on its minWidth. Built with floating-point contraction, which clang applies by default (-ffp-contract=on) wherever the target has FMA, Yoga lays the item out at its flex basis:
YGNodeRef row = YGNodeNew();
YGNodeStyleSetFlexDirection(row, YGFlexDirectionRow);
YGNodeStyleSetWidth(row, 20);
YGNodeStyleSetHeight(row, 10);
YGNodeRef item = YGNodeNew();
YGNodeStyleSetFlexBasis(item, 90);
YGNodeStyleSetFlexShrink(item, 1);
YGNodeStyleSetMinWidth(item, 10);
YGNodeInsertChild(row, item, 0);
YGNodeRef sibling = YGNodeNew();
YGNodeStyleSetWidth(sibling, 10);
YGNodeInsertChild(row, sibling, 1);
YGNodeCalculateLayout(row, YGUndefined, YGUndefined, YGDirectionLTR);
bash repro.sh from the gist below clones main, builds Yoga with this program twice, with contraction and with -ffp-contract=off, and runs both. In ubuntu:24.04 on x86-64, where contraction needs -mfma:
react/yoga 41118bd, Ubuntu clang version 18.1.3 (1ubuntu1), Linux x86_64
contraction on (-mfma): 90 + (-80 / -90) * -90 is 9.99999905 fused, 10 rounded at each step; item width 90
contraction off (-ffp-contract=off): 90 + (-80 / -90) * -90 is 9.99999905 fused, 10 rounded at each step; item width 10
summary: react/yoga 41118bd lays the item out 90 wide, its flex basis, with contraction, and 10 wide, its min-width, without
and on arm64, with no flag:
react/yoga 41118bd, Ubuntu clang version 18.1.3 (1ubuntu1), Linux aarch64
contraction on: 90 + (-80 / -90) * -90 is 9.99999905 fused, 10 rounded at each step; item width 90
contraction off (-ffp-contract=off): 90 + (-80 / -90) * -90 is 9.99999905 fused, 10 rounded at each step; item width 10
summary: react/yoga 41118bd lays the item out 90 wide, its flex basis, with contraction, and 10 wide, its min-width, without
Expected Behavior
item width 10 with contraction, as without it: the item shrinks onto its minWidth.
Actual Behavior
item width 90: with contraction the item keeps its flex basis and overflows the 20-wide row.
In yoga/algorithm/CalculateLayout.cpp at 41118bd:
distributeFreeSpaceFirstPasscomputesbaseMainSize = childFlexBasis + remainingFreeSpace / totalFlexShrinkScaledFactors * flexShrinkScaledFactor, which contraction turns into one fused multiply-add:9.99999905here, against10when the product is rounded first.baseMainSize != boundMainSizecompares exactly, so against the bound of10the first pass freezes the item:deltaFreeSpacetakes10 - 90, all-80of the free space, which leavesremainingFreeSpaceat exactly 0.distributeFreeSpaceSecondPassshrinks or grows only whileremainingFreeSpaceis below or above 0, so the item keepsupdatedMainSize = childFlexBasisand is never bounded to its minimum, though the first pass expects a frozen item's "min/max constraints should also trigger in the second pass".
#2038 is another FMA residual in these two passes.
Link to Code
https://gist.github.com/YevheniiKotyrlo/45b864d98eae145b9ef1879d97783657
- Lenguaje dominante
- C++
- Estrellas
- 18.9k
- Forks
- 1.6k
- Merge medio
- 17 h 9 min
- PR fusionados (30 d)
- 13
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de react/yoga
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
flex-shrink scales by the border-box flex basis instead of the inner (content) flex base sizeAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
A child pinned with bottom: 0 can end a pixel above its parent's bottom after pixel roundingPosiblemente ocupada @Pduhard la tomó hace 5 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
Yoga 3.2.2 patch releaseAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
Todos los issues de react/yoga
Issues similares
-
test(tools): two testkit cache tests fail unless GOCACHE and GOMODCACHE are in the environmentAbiertobacklog
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
EchoTools/nevr-runtime#2385 ·
Los mantenedores suelen responder en 1 día
-
type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
tensorflow/tflite-micro#3995 ·
Los mantenedores suelen responder en 1 día
-
CPU update 1.31xAbiertospeed-report
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
mw00/project-maya#961 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
not for AI lovers
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
OSGeo/gdal#15515 · 1 comentario ·
Los mantenedores suelen responder en 1 día