“If you’re gonna tell a story, come with some attitude. Don’t be all corny with this shit,” Don Cheadle sneers, as an aging Miles Davis, in the first scene of Miles Ahead. Davis addresses an interviewer behind the camera, who responds: “Well, you’re the artist, Miles… how would you tell it?” Miles thinks a second, then puts his ruby-red horn (one of his ‘80s trademarks) to his lips and winds up to play a note. Then the film begins.

Here, Cheadle articulates (not so subtly) the primary rule of engagement for the film: a major labor of love for him — its star, co-writer, director, and musical consultant — which evolved from a nearly-ten-year-old idea and was ultimately realized through help from an Indiegogo campaign. Cheadle is a man well-versed in the typical gambits of the Hollywood biopic, having been a part of several, from his role as Sammy Davis Jr. in 1998’s The Rat Pack to his portrayal of humanitarian hero Paul Rusesabagina in Hotel Rwanda. Miles Ahead consciously attempts to subvert expectations. Instead of trying to chronologically summarize the life and work of Davis — one of the most influential and chameleonic figures in the history of Western music — the movie focuses on just two narratives. Both are composites, as opposed to literal evocations of true events. It’s a smart move, making for a tauter, more engaging film, and certainly one with plenty of “attitude.”

The main plot is set, ironically, toward the end of the five-year stretch — the second half of the 1970’s — when Miles was not making new music, and struggling with a fierce cocaine addiction. During this time, he was hounded by many reporters, and in Cheadle’s film, Ewan McGregor’s freelance writer character, David Brill, is a composite of them. Brill weasels his way into Miles’ good-enough graces, though he’s just desperate for a story and not trying to be his buddy, and we embark on a convoluted, action-packed story involving Brill taking Miles to score coke in a Columbia University dorm, bonding via a punching bag, and ultimately getting in car-to-car shoot-outs with record exec goons in order to secure some precious master tapes Miles doesn’t want to give up.

Plenty and nothing happens, but in the process Cheadle takes lengthy detours into Miles’ head. He remembers points in his tortured relationship with his ex-wife, Frances Davis (notably pictured on the cover of the 1961 Miles standards album Someday My Prince Will Come). Davis’ retrospective regret for his philandering and physical abusiveness is implied but not directly articulated; swept up incidentally in the flashbacks are snippets from the formative moments in Miles’ early career, from the recording of his orchestral albums with arranger Gil Evans, to the club gigs surrounding the release of Kind of Blue, to — most memorably — an explosive scene where Frances and Miles slap each other around the room while the members of Miles’ second great quintet (Herbie Hancock, Wayne Shorter, Ron Carter, and Elvin Jones) wait to play in the basement.

This is Cheadle’s first film, and the slightly primitive transitions between the primary narrative and the jumbled memories feel a bit like a student-film tribute to Federico Fellini’s 8 ½. Additionally, there’s a young aspiring trumpeter and junkie character in the main story (portrayed by Keith Stanfield) who serves, a bit too obviously — and to too little effect — as a dopplegänger of the younger Miles. The main narrative is something of a shaggy dog tale: It’s willfully amorphous, and even seems to repeat itself. But our interest is held — as in most biopics that we celebrate, as oppose to mock — by Cheadle’s performance, which is at once a dead-on impression of Miles’ unmistakable, subterranean rasp of a speaking voice, and tremendously emotionally subtle. It’s also, quite often, hilarious: Miles’ foul-mouthed misanthropy and penchant for one-liners is forever immortalized in interviews and his Quincy Troupe-assisted autobiography, and Cheadle takes great care to get Davis’ impeccable timing right (On how he learned the piano: “Just woke up black, knew how to play.”)

The film’s aims are modest, perhaps sometimes a bit too much so. At times, it seems to be treading water. The extended saga involving the corporate fatcats at Columbia — primarily, a mustachioed antagonist portrayed by Michael Stuhlbarg — outstays its welcome.

The movie’s main thrust is encapsulated most elegantly by the film’s final scene: a out-of-time jam between Cheadle-as-Miles and an all-star band led by the film’s musical director Robert Glasper. Legendary Miles collaborators Herbie Hancock and Wayne Shorter are there, as well as modern rock and jazz players like nu-bluesman Gary Clark Jr. This dreamlike moment pays tribute to the timelessness of Miles’ sound, as well as speculating about where he might fit into the current music scene were he alive to be a part of it; it then transitions into a Miles-sampling hip-hop track from ex-Organized Konfusion motormouth MC Pharoahe Monch as the credits roll, suggesting one of the ways in which the torch has been passed.

At no point does Cheadle’s film acknowledge that Miles Davis ever died: It folds time together, and makes Miles a virile and dynamic presence in an invented alternate dimension. By doing this, Miles Ahead operates in the same vein as films like Todd Haynes’ Dylan pastiche I’m Not There, moving beyond the strictly factual to make a film that attempts to mirror the ethos of the work of the artist it portrays. Miles Ahead feels unruly and whittled down to razor-sharpness at the same time, its circuitous pacing of a piece with Davis’ most meandering and impressionistic jams (The film’s spiritual climax centers around one of these — supposedly, the tape of the session Miles has almost killed himself to hold onto). Ultimately, it’s a must-see for fans of Miles Davis and Cheadle — a ultimately slight but unconventional movie full of plenty of smart ideas.