cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

jean-claude
Journeyman III

Is it possible to access to some direct CAL functions within a BROOK program??

Brook/CAL programming interface

Hi,

I do have some basic questions related to accessing directly CAL from a Brook program (with some caution obviously)

1) example 1

assuming you have something like:

float a<height,width>;

float b<height,width>; // intermediate working stream





streamread(a,...)

process(a,b,..)

streamwrite(a,...)

Then if I understand correctly, you're still left with stream b somewhere in the memory...

Would it be possible to deallocate this memory by using:

calresfree(...) or someting else, if yes what should be the resource pointer passed to calresfree ???

2) example 2

How to access from Brook, functions such as :

calDeviceGetAttribs(...)

This indeed would help to figure out the running environment

Thanks

Jean-Claude

 

0 Likes
4 Replies
udeepta
Staff

No. But it is possible to write a Brook+ kernel, generate IL using BRCC or ShaderAnalyser, and use the IL with a CAL program.

0 Likes

Ok too bad!

Then coming back top example 1, how to deallocate intermediate working stream without streamwriting them into memory?

0 Likes

Originally posted by: jean-claude Ok too bad!

 

Then coming back top example 1, how to deallocate intermediate working stream without streamwriting them into memory?

 

Currently, streams have auto-pointer behavior -- they are de-allocated when they go out of memory. We are working towards adding dynamic allocation behavior in the next release.

float a<height,width>;

{

float b<height,width>; // intermediate working stream





streamread(a,...)

process(a,b,..)

} //b goes out of scope

streamwrite(a,...)

 

0 Likes
nberger
Adept I

Hi!
If you look at the code generated by brcc, you will find that it creates stream objects which have a relatively simple interface (why is there no documentation on that?).
I allocate streams with new and deallocate them with delete, which seems to also free the resources on the GPU. Questions to someone from AMD:
- I there any reason why I should not be doing this? (I observe strange things from time to time...)
- Will streamwriting indeed deallocate the GPU memory?
- What if I want to access results and also use them in a subsequent kernel call?
Thanks, Nik
0 Likes