-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resizable (jagged) vectors can't have a non-zero starting size #95
Comments
Conceptually, option no. 2 sounds like the most reasonable one, given we can break circular dependencies. |
By the way, are we interested in trying to type-erase the copy objects at all? |
I'm not sure what you mean by this... The Then, all the classes that derive from So... what did you have in mind exactly? 😕 |
I'm in favor of the 2nd option as well. Doing copy.setup() each time after creating a buffer anyway seems like it is a part of constructing the object so I think it is a good idea to do it inside the constructor. I don't have a clear picture in mind of what do you mean by the 3rd option though so feel free to write more details if you want 😉 |
What I'm referring to is if we go with option 2, the constructor needs to accept any copy object. I had forgotten that |
This #^&*$ thing got closed by #199 automatically. 😦 I should have paid more attention. @guilhermeAlmeida1, let's discuss here instead of #219. Unfortunately this issue has been with us for a very long time. I'm very open for a good API that would allow us to initialize the jagged vector sizes to something non-zero in a convenient way... 🤔 |
Let's close this one finally. The new API of the buffers does not claim that the starting sizes of resizable buffers could be anything but zero. (One needs to |
As I mentioned in #94, this has been bothering me for a while... With a constructor like
, one should assume that the created vector buffer would have a starting size of
size
. But in the current implementation it doesn't. It always starts from 0. 😦When you set up a resizable (jagged) vector currently, you do it like:
Where
m_copy
is one of the "platform specific" copy objects. The problem here is that the buffer constructor currently has no way of storing the starting size that it received, in the memory that it would allocate with the memory resource that it receives. In case the memory resource allocates non-host-accessible memory, one needs to write to that memory using the appropriate "copy class". But by the time that we use thevecmem::copy::setup(...)
function, that original size variable is lost. (The buffer does not store it anywhere.)There are a couple of ways out of it, but they either require some bigger re-organisation in the code, or a setup that I wouldn't really like. I think the following are all our options here:
vecmem::copy::setup(...)
when initialising the (device) memory. Technically this could work (I think...), but I just really don't like this design. (But maybe you guys could convince me otherwise...)vecmem::copy
already knows about the buffer types...)vecmem::copy
for constructing resizable (jagged) vector buffers. This is very similar to option number 2, and would introduce a design that we don't use anywhere else in the project so far.So... Any objections to having to create resizable buffers with code like:
?
@konradkusiak97, I'm interested in your opinion as well. 😉
The text was updated successfully, but these errors were encountered: