Search found 72 matches

by Velatus
May 21, 2020 12:50
Forum: General
Topic: File I/O Issue - SOLVED
Replies: 11
Views: 1079

Re: File I/O Issue - SOLVED

@dodicat: I also tried to replicate the error, but was unsuccessful as well. Funny thing is that I also defined MN_I8S as 123 :-) @Velatus: Always the problem with programming. One wants to do X, but one does know that it is called X. How to find documentation of X? Of even how to ask questions abo...
by Velatus
May 21, 2020 12:47
Forum: General
Topic: File I/O Issue - SOLVED
Replies: 11
Views: 1079

Re: File I/O Issue - SOLVED

Hi @dodicat. Actually, i8surf is a (somewhat barebone) 2D array, or a wrapper around an int8 pointer and a descriptor, depending on how you chose to look at it. It is implemented as follows: type i8surf private: as uint16 w 'width as uint16 h 'height as int8 ptr p 'payload public: '... declare prope...
by Velatus
May 21, 2020 10:48
Forum: General
Topic: File I/O Issue - SOLVED
Replies: 11
Views: 1079

Re: File I/O Issue - SOLVED

There is this remark on the Namespace wiki page : "To access duplicated symbols defined in the global namespace, add one (or two) dot(s) as prefix: .SomeSymbol (or ..SomeSymbol if inside a With..End With block)." I usually try to avoid using the freebasic keywords as subs/function, but th...
by Velatus
May 21, 2020 10:08
Forum: General
Topic: File I/O Issue - SOLVED
Replies: 11
Views: 1079

Re: File I/O Issue

Do you have member procedures named 'get' in your 'i8surf' type? If so, try replacing all 'get #f, ...' with '.get #f, ...' in order to call the predefined 'get #' instruction outside the type, and not by default a member procedure 'get' (not matching). Actua...
by Velatus
May 21, 2020 8:16
Forum: General
Topic: File I/O Issue - SOLVED
Replies: 11
Views: 1079

File I/O Issue - SOLVED

Hi everyone. I'm getting a compiler error which I don't understand. I have this very simple static method in one of my UDTs, which is supposed to open a file in binary mode and read a bunch of values: function i8surf.load (n as string) as i8surf dim as i8surf r = i8surf() 'return value dim as uint32...
by Velatus
Nov 23, 2013 23:09
Forum: General
Topic: SIMD Tutorial ?
Replies: 30
Views: 4191

Re: SIMD Tutorial ?

@MichaelW: This could actually be the right thing to do ! Allocating an aligned chunk of memory for say, a few hundreds or thousands of vectors (depending on the user's needs, who'd #define some constant so he would have exactly what his program needs), and then implement the vec2's (and vec3's an s...
by Velatus
Nov 23, 2013 13:20
Forum: General
Topic: SIMD Tutorial ?
Replies: 30
Views: 4191

Re: SIMD Tutorial ?

I thought so. The version you just sent is indeed much slower (3 times actually). I tried another approach, which basically deallocated the pointer passed to it before returning, and it ran around 30% faster than your version, but still not fast enough, or at least not nearly as fast as my original,...
by Velatus
Nov 23, 2013 11:42
Forum: General
Topic: SIMD Tutorial ?
Replies: 30
Views: 4191

Re: SIMD Tutorial ?

I managed to implement SSE_addVec2 in a way that's actually faster than addVec2. Here's the complete listing (you might want to scroll directly to the bottom). Note that the O_DOUBLE_PRECISION version is not implemented so don't try to #define it: namespace o #ifdef O_DOUBLE_PRECISION type float as ...
by Velatus
Nov 23, 2013 10:11
Forum: General
Topic: SIMD Tutorial ?
Replies: 30
Views: 4191

Re: SIMD Tutorial ?

@fxm: Just implemented your version of the constructors and destructor. It processes 1000000 vec2's in 0.47 sec instead of 0.51 sec. A promising start. Thanks a lot.
by Velatus
Nov 23, 2013 9:49
Forum: General
Topic: SIMD Tutorial ?
Replies: 30
Views: 4191

Re: SIMD Tutorial ?

Thanks a ton for all the help, guys ! I've been sick for the last couple of days so I couldn't write much code, but I'll give it a shot today and keep you posted.

@fxm: That's quite an elegant implementation you have here.

@MichaelW: Thanks a lot for the macro. Don't worry, I'll do the testing.
by Velatus
Nov 20, 2013 11:56
Forum: General
Topic: SIMD Tutorial ?
Replies: 30
Views: 4191

Re: SIMD Tutorial ?

@FXM: Thanks for answering. I rewrote the SSE_addVec2 function and implemented the copy constructor. Everything works as supposed to, but after running some tests, it, appeared that the SSE version was slower than the regular one, by a factor of frigging TWO. So question mark, here... I tried a few ...
by Velatus
Nov 19, 2013 22:33
Forum: General
Topic: SIMD Tutorial ?
Replies: 30
Views: 4191

Re: SIMD Tutorial ?

Okay, this kind of works: function SSE_addVec2(byref a as o.vec2, byref b as o.vec2) as o.vec2 dim as o.vec2 r asm mov eax, [a] mov eax, [eax] lea eax, [eax] movaps xmm0, [eax] mov eax, [b] mov eax, [eax] lea eax, [eax] movaps xmm1, [eax] addps xmm0, xmm1 mov eax, [r] lea eax, [eax] movaps [eax], xm...
by Velatus
Nov 19, 2013 21:42
Forum: General
Topic: SIMD Tutorial ?
Replies: 30
Views: 4191

Re: SIMD Tutorial ?

Thanks for answering, but it doesn't work. Here's the code: function SSE_addVec2 (byref a as o.vec2, byref b as o.vec2) as o.vec2 dim as o.vec2 r asm mov eax, [a] lea eax, [eax] movaps xmm0, [eax] mov ecx, [b] lea ecx, [ecx] movaps xmm1, [ecx] addps xmm0, xmm1 mov edx, [r] lea edx, [edx] movaps [edx...
by Velatus
Nov 19, 2013 17:17
Forum: General
Topic: SIMD Tutorial ?
Replies: 30
Views: 4191

Re: SIMD Tutorial ?

Hi. So I managed to implement a vec2 type as follows: namespace o #ifdef O_DOUBLE_PRECISION type float as double #else type float as single #endif end namespace namespace o type vec2 'private: as float ptr _data as ubyte _offset 'public: declare constructor () declare constructor (byref as float, by...
by Velatus
Nov 17, 2013 0:52
Forum: General
Topic: SIMD Tutorial ?
Replies: 30
Views: 4191

Re: SIMD Tutorial ?

@Richard: Thank you very much sir. @MichaelW: Thanks for all the useful information and your delving into dusty cd's. According to what I've read here and there, and since SSE instructions were introduced circa 2000, I think you're right about the pre-SP (in)compatibility issue. My latest (and sort ...

Go to advanced search