Hi,

[General issue on specification [promise] in B.]

A.
[Are all allocations in Julia cache-line aligned (or at least 32-byte 
aligned, that is the common size)? I'm not asking for a specification of 
32-byte aligned or whatever the size of cache-line is, but a big/ger, 
appropriate for speed, alignment would be nice.. - and a way to ask for 
that size..]


I assume Julia's allocations as are at least word aligned as they *should 
be* (as any sane allocator, say (good) malloc in C). But in Julia and C 
pointers (not allocations, I might be wrong about C in some version..?) can 
be byte aligned.

[Since Julia can manage/take over memory allocated in C, that answers my 
question, if allocations there can be byte aligned.. Or maybe Julia doesn't 
handle all versions of malloc in C?]


Now, in C you can point in the middle of your allocated array and that is 
ok as you have to deallocate yourself.. In Julia I have to rely on the GC 
and this seems tricky to test (that an object will not turn into garbage 
with only a byte pointer to it) or look for in the (low-level I guess..) 
Julia code. Anyway, that code could change..


[I know an index/cursor, with-in the array, is a possibility. I however, 
want a pointer in my object to point with-in my own (sub-)object and have 
the possibility of reallocating on the heap and move and point outside of 
my own object. Hope you follow..]


What I'm saying, really, is there an (implicit, that should maybe be 
explicit?) specification for how at least the GC should handle things? 
Note, I'm not only talking about pointing to the start of a sub-object of 
an (compound) object, but as described with-in, say, a Uint8 array.

[Would it matter if the types differ? Say you have a Uint16 array, could 
you have a pointer to Uint8 of either byte therein?]


B.
In general, I'm not sure having a full specification of Julia is too useful 
and not asking for that.. With Julia's permissive MIT licensed code (and 
macros.. that allow many (most all?) extensions..) I'm hoping there will be 
no major forks of Julia.. I'm pretty sure there will not be any 
reimplementation of full Julia from scratch (why would anyone?).


I can only really forsee a full reimplementation of the GC (already done.. 
right?, and maybe again, say for (thread-safe and/or) full-hard-realtime.. 
might need to be a separate julia binary or switchable GC..).


Do we need a specification promise like:

https://golang.org/doc/go1compat


C.
I know you can look up the cache-line size of the CPU (on Linux) in /proc. 
Do you know of a cross-platform way (or just for the other platforms so I 
could make code in Julia)? If you need some specific instructions like, 
CPUID, then I guess you are out of luck with Julia.. Or you really want 
this to be part of the OS API anyway.

[Only knowing the cache-size alignment is helpful, but less so if the 
allocations are not aligned..] I'm counting, not cycles so much, but 
cache-misses.


D.
To access an object (on the heap) I can expect one cache-miss. And another 
getting the size of the object? I'm not sure where that is stored, "with-in 
the object allocation" (just preceding?)? Or in metadata separate from it? 
Anyway, it might be a separate cache-line, but accesses to adjacent 
cache-lines should be faster than distant ones?

-- 
Palli.

Reply via email to