The shape axis can say a resolution is partial. The dtype axis cannot, so an incomplete dtype union is indistinguishable from a complete one, and at least one consumer decides on the difference.
The Asymmetry
ShapeResult carries members beside an explicit hasUnknown remainder, added so a partially resolved value could say so rather than presenting its resolvable subset as the whole answer.
A dtype resolution is a bare Set<DType>. There is nowhere to record that a member was dropped, so a union short by an unreadable member reads exactly like a union that was complete.
It Is Read
ElementWiseOperation decides on plurality:
if (dtypes == null || dtypes.size() != 1) return null;
So a set's SIZE is load-bearing, and a set that is short because something could not be read is treated as a confident single dtype rather than as an incomplete one.
The Current Mitigation, And Why It Is Not The Fix
The dtype-argument resolver was changed under #860 so that an unreadable member contributes UNKNOWN rather than being skipped, precisely so the union carries its own incompleteness into the plurality check. That was measured to cost nothing on the program that motivated it.
It works by convention rather than by structure: UNKNOWN as a MEMBER is being used to mean "this union is partial", which is a different claim from "this value may have unknown dtype", and nothing distinguishes them. Every other producer of dtype sets is free to be short without saying so, and none of them has been audited for it.
What A Fix Would Look Like
The dtype axis wants what the shape axis has: a result carrying its members beside an explicit marker that something did not resolve. That makes partiality a property of the result rather than of a sentinel member, lets a consumer ask rather than infer, and removes the overload on UNKNOWN.
Related
#836 concerns what a dtype PLURALITY means when it is real, specifically that a consumer-imposed plurality and an origin plurality want opposite treatments. This is the neighbouring question of whether a plurality is real at all. Both are reasons a bare set is the wrong carrier, and a fix for either should probably know about the other.
The shape axis can say a resolution is partial. The dtype axis cannot, so an incomplete dtype union is indistinguishable from a complete one, and at least one consumer decides on the difference.
The Asymmetry
ShapeResultcarriesmembersbeside an explicithasUnknownremainder, added so a partially resolved value could say so rather than presenting its resolvable subset as the whole answer.A dtype resolution is a bare
Set<DType>. There is nowhere to record that a member was dropped, so a union short by an unreadable member reads exactly like a union that was complete.It Is Read
ElementWiseOperationdecides on plurality:So a set's SIZE is load-bearing, and a set that is short because something could not be read is treated as a confident single dtype rather than as an incomplete one.
The Current Mitigation, And Why It Is Not The Fix
The dtype-argument resolver was changed under #860 so that an unreadable member contributes
UNKNOWNrather than being skipped, precisely so the union carries its own incompleteness into the plurality check. That was measured to cost nothing on the program that motivated it.It works by convention rather than by structure:
UNKNOWNas a MEMBER is being used to mean "this union is partial", which is a different claim from "this value may have unknown dtype", and nothing distinguishes them. Every other producer of dtype sets is free to be short without saying so, and none of them has been audited for it.What A Fix Would Look Like
The dtype axis wants what the shape axis has: a result carrying its members beside an explicit marker that something did not resolve. That makes partiality a property of the result rather than of a sentinel member, lets a consumer ask rather than infer, and removes the overload on
UNKNOWN.Related
#836 concerns what a dtype PLURALITY means when it is real, specifically that a consumer-imposed plurality and an origin plurality want opposite treatments. This is the neighbouring question of whether a plurality is real at all. Both are reasons a bare set is the wrong carrier, and a fix for either should probably know about the other.