caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Eray Ozkural <examachine@gmail.com>
To: Guillaume Yziquel <guillaume.yziquel@citycable.ch>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Unboxing: how to do it best?
Date: Sat, 15 Jan 2011 16:00:21 +0200	[thread overview]
Message-ID: <AANLkTinAptP4G6JZH+Msyf_99UDkWkSDF6AwH1hRfHHo@mail.gmail.com> (raw)
In-Reply-To: <20110115123838.GS4195@localhost>

[-- Attachment #1: Type: text/plain, Size: 2619 bytes --]

On Sat, Jan 15, 2011 at 2:38 PM, Guillaume Yziquel <
guillaume.yziquel@citycable.ch> wrote:
>
>
> If you do not care about having the annotation available at runtime
> instead of being something static (after all, MPI datatypes are
> available at runtime), you could go for encapsulating type information
> in first class modules representing datatypes.
>
> Then, for instance, given a datatype, you may wish to construct the
> datatype of an array of such types. Such a function needs to know
> details about the way OCaml boxes or unboxes different kinds of arrays,
> and it can be done (though rather awkwardly in my case).
>
> So first-class modules encapsulating datatype information seems to me a
> worthwile option and the only solution I could come with to mimic what
> would be done in C++ with traits.
>


 Hi Guillaume,

That's a good idea.

Theoretically a functor transforms programs. Radical program rewriting would
be just the thing to do with a functor, but I'd rather have it in the
compiler.

After all program-transformation is what an optimization pass is
essentially. There is absolutely nothing wrong with doing it in a high-level
way, as long as it doesn't introduce runtime overhead.

Has anyone designed a cool compiler like that? :)


As for 'annotating type definitions', where would you put the line as to
> what 'annotating' means? Using type-conv-like Camlp4 processing?
>
>
I haven't thought much about the implementation, except verifying that it's
just an extension of the present kinds of unboxing in the runtime.

What I would like is something like (thinking of a typical simulation
datatype):

type cvector4 = ][ (complex * complex * complex * complex)

where ][ would be a "type operator" enforcing a flattened representation of
the type expression it is applied to. It would just change the layout so it
would be equivalent to the same type without the unboxing op.

Preprocessing might be one way to implement it, but i don't think it's an
easy implementation at any rate.

Just a small idea that I couldn't let slip from my mind.

But as to avoiding pointer chasing, I think there's no workaround to the
> way OCaml handles memory. The only solution I can come of is the
> obvious: use arrays or bigarrays and smart datatypes.
>

Smart datatypes is OK, I think you could substitute many datatypes with such
a thing, but I'm not sure how easy that would be to do in real-world
programming?

Best,

-- 
Eray Ozkural, PhD candidate.  Comp. Sci. Dept., Bilkent University, Ankara
http://groups.yahoo.com/group/ai-philosophy
http://myspace.com/arizanesil http://myspace.com/malfunct

[-- Attachment #2: Type: text/html, Size: 3787 bytes --]

  reply	other threads:[~2011-01-15 14:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-15 12:02 Eray Ozkural
2011-01-15 12:38 ` Guillaume Yziquel
2011-01-15 14:00   ` Eray Ozkural [this message]
2011-01-15 17:23     ` Guillaume Yziquel
2011-01-15 18:33       ` Eray Ozkural
2011-01-16 16:53         ` Jon Harrop
2011-01-18 23:49         ` Guillaume Yziquel
2011-01-15 12:41 ` bluestorm
2011-01-15 13:37   ` Eray Ozkural
2011-01-16 17:03 ` Jon Harrop

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTinAptP4G6JZH+Msyf_99UDkWkSDF6AwH1hRfHHo@mail.gmail.com \
    --to=examachine@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=guillaume.yziquel@citycable.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).