Skip to content

GPU texture system prototype#5228

Open
aconty wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
imageworks:gputex
Open

GPU texture system prototype#5228
aconty wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
imageworks:gputex

Conversation

@aconty

@aconty aconty commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

Implemented as a standalone testsuite prototype, without modifying the core OpenImageIO library, this work demonstrates the proposed data model and runtime design in a working executable that already produces images.

The prototype validates the host/device architecture end to end: request-driven texture lookup, residency updates, retry flow, filtering behavior, and output generation. It is intentionally scoped to the testsuite so we can iterate quickly on API shape, data structures, and execution strategy before promoting pieces into library code.

More details in README.md, started from SPEC.md. Designed and written by me, assisted by gpt-5.3-codex in copilot.

Nobody wanted to jump into this task, including myself. So I wrote a prototype SPEC for AI to do it. Since I didn't like where it was going I took full control. of it and ended up enjoying the job a lot. Came up with a couple of patterns that I like a lot. My aim was simplicity and clarity. Hope you people like it.

Tests

The prototype itself is a test. This doesn't interfere with the rest of the library.

Checklist:

  • I have read the guidelines on contributions and code review procedures.
  • I have read the Policy on AI Coding Assistants
    and if I used AI coding assistants, I have an Assisted-by: TOOL / MODEL
    line in the pull request description above.
  • I have updated the documentation if my PR adds features or changes
    behavior.
  • I am sure that this PR's changes are tested in the testsuite.
  • I have run and passed the testsuite in CI before submitting the
    PR, by pushing the changes to my fork and seeing that the automated CI
    passed there. (Exceptions: If most tests pass and you can't figure out why
    the remaining ones fail, it's ok to submit the PR and ask for help. Or if
    any failures seem entirely unrelated to your change; sometimes things break
    on the GitHub runners.)
  • My code follows the prevailing code style of this project and I
    fixed any problems reported by the clang-format CI test.
  • If I added or modified a public C++ API call, I have also amended the
    corresponding Python bindings. If altering ImageBufAlgo functions, I also
    exposed the new functionality as oiiotool options.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 9, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: aconty / name: Alejandro Conty (d2e27d0)

@aconty aconty force-pushed the gputex branch 2 times, most recently from d2e27d0 to a4b4e67 Compare June 9, 2026 16:25
@aconty

aconty commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Implemented as a standalone testsuite prototype, without modifying
the core OpenImageIO library, this work demonstrates the proposed
data model and runtime design in a working executable that already
produces images.

The prototype validates the host/device architecture end to end:
request-driven texture lookup, residency updates, retry flow,
filtering behavior, and output generation. It is intentionally
scoped to the testsuite so we can iterate quickly on API shape,
data structures, and execution strategy before promoting pieces
into library code.

More details in README.md, started from SPEC.md. Designed and
written by me, assisted by gpt-5.3-codex in copilot.

Signed-off-by: Alejandro Conty <aconty@imageworks.com>

@lgritz lgritz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see where you're going with this, and LGTM. The threshold is pretty low since this is just a testsuite experiment for now, so by no means does anything need to be perfect or final.

I made a number of comments, but really it's nothing that we can't fix up as we continue to work on it, if you are inclined to address any of it in subsequent PRs rather than now.

I would like to discuss it at the TSC meeting today before we merge it, to make sure nobody has any reservations.

One overarching comment/question -- would it be a big simplification to the scheme (and would it be feasible and performant on today's HW) to use unified/managed memory rather than separate allocations and explicit copies?

Comment on lines +22 to +36
inline uint64_t
ptrtag(const char* s)
{
if (!s || !s[0])
return 0;
return OIIO::Strutil::strhash64(std::strlen(s), s);
}

template<size_t N>
inline constexpr uint64_t
ptrtag(const char (&s)[N])
{
static_assert(N > 1, "tag literal must be non-empty");
return OIIO::Strutil::strhash64(N - 1, s);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the string_view overload of Strutil::strhash64 subsume both of these?

Comment on lines +14 to +15
template<class T, size_t N> struct vector_lite : public std::array<T, N> {
using Base = std::array<T, N>;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++26 includes a new inplace_vector<> that I think is the same as this. If so, we should adopt their nomenclature and as much of the semantics as makes sense.

I'm a little suspicious of it being is-a std::array versus has-a. Is it just to save a few lines by not having to repeat operator[] and the like? Are we inadvertently inheriting anything from std::array that we wouldn't want here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do that change.


void push_back(const T& value)
{
assert(m_size < N);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer OIIO_CONTRACT_ASSERT these days.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

Comment on lines +69 to +70
std::vector<std::string> m_texture_paths;
std::unordered_map<std::string, TextureMetadata> m_metadata_cache;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would these be better as ustring? (asking; I do not yet have a strong opinion)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed

Comment on lines +85 to +89
return loader_error("unsupported tile size for " + filename + " got "
+ std::to_string(spec.tile_width) + "x"
+ std::to_string(spec.tile_height) + " expected "
+ std::to_string(TileRecord::kTileWidth) + "x"
+ std::to_string(TileRecord::kTileHeight));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strutil::format is probably more idiomatic for OIIO than string::operator+ (and almost certainly much faster). If we want to be really fancy, we can make loader_error itself format input instead of passing an already formatted string.

@lgritz

lgritz commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Needless to say, there are a whole bunch of things here that are idiomatically different from TextureSystem (in implementation as well as in use). I'm noting that here only to say that as we eventually make this all part of TS, we'll probably want to revisit which should become more like the other, or if TS should support multiple usage idioms.

For example, should TS, even on the CPU, have a set of texture lookup calls that have a "texture not resident" result rather than being obligated to load it within the texture lookup? And a "here are a set of tiles we need, go get them all as efficiently as possible" function. It would be interesting to know how that approach to texture compares to what we're doing now, maybe we'd find it to be the method of choice no matter which HW you're running on.

@aconty

aconty commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Your unified memory support comment got me thinking. I'm going to spin this a bit more because I think I can do that and also simplify.

The API design, yes, probably better to discuss that live.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants